Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Serving a file with a download manager

Status
Not open for further replies.

Stretchwickster

Programmer
Apr 30, 2001
1,746
GB
Hi there,

I have a PHP page which lists downloads available to our customers. In the last few months, we've been getting a lot of customers informing us that IE reports "Download Complete" even though the file size of the download indicates that it has not managed to download the entire file. Obviously, we successfully tested the download before serving it up to our customers.

When downloading large files from other sites (at work), I've often encountered this problem (IE reports "Download Complete" yet file is incomplete). However, downloading the same file from home works fine. I've experienced this behaviour in both IE and FF.

Recently, I was downloading a large (334MB) file from an external site and they offered two downloads:
- Product X
- Product X (with download manager)

I clicked the latter option and a Java applet opened in my browser and proceeded to successfully download the entire file. I understand that this download manager can also resume downloads if interrupted.

I have a few questions related to this problem:
1) Any suggestions (other than a download manager) as to how to fix this problem?
2) Can anyone recommend a download manager product that I could integrate with my file download in order to create a bit more robustness?

Any advice/insights would be much appreciated!

Clive
Runner_1Revised.gif

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer." (Paul Ehrlich)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096
 
Hi Clive

curious that IE reports the download as successful. are you sure that you are passing the file size through the headers?

implementing download recoverability is not altogether straightforward in php although I understand some webservers provide it natively. somehow one would need to tell php what bitoffset to start at AND then have the client side know how to put the two (or more) parts of the file together. i'll have a ponder.

as for a dl manager: for the above reasons i'd think you need something in flash or java (or perhaps js). I don't have a recommendation personally, but then i've never run in to the problem that you report.


 
Hi Justin,

I'm pretty sure the headers are correct. I'm using...
Code:
header('Content-Length: ' . $fileLength);
...to pass the file size through the headers.

Note, this problem doesn't just happen with the files we make available for download, it has also happened to me on a number of other notable sites (e.g. adobe.com) and in Firefox too.

Clive

Clive
Runner_1Revised.gif

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer." (Paul Ehrlich)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096
 
curious still. does it happen with all browsers or just IE?

I assume $fileLength is derived from filesize($file)?

and do you then use readfile() or fpassthru()?
 
It happens with both IE and Firefox.
$fileLength is indeed derived from the filesize function.
I then use readfile.

Clive
Runner_1Revised.gif

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer." (Paul Ehrlich)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096
 
that does not sound like a typical php problem. do the server logs disclose anything strange?
have you tried alternatives (assuming you have enough memory) such as file_get_contents($file) and then an echo ?

i'm wondering whether there is a timeout or null byte happening somewhere. on the latter - do you specify that the transfer is binary?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top