<p>We are using a PHP scripting for tunnelling file downloads, since we don't want to expose the absolute path of downloadable file:</p>

<pre><code>header("Content-Type: $ctype");
header("Content-Length: " . filesize($file));
header("Content-Disposition: attachment; filename=\"$fileName\"");
readfile($file);
</code></pre>

<p>Unfortunately we noticed that downloads passed through this script can't be resumed by the end user. </p>

<p>Is there any way to support resumable downloads with such a PHP-based solution?</p>

Yes. Support byteranges. See
RFC 2616 section 14.35
.
It basically means that you should read the
```
Range
```
header, and start serving the file from the specified offset.
This means that you can't use readfile(), since that serves the whole file. Instead, use
fopen()
first, then
fseek()
to the correct position, and then use
fpassthru()
to serve the file.