Page 1 of 1
Big file download problem
Posted: Tue 29. Aug 2006, 11:28
by st3fek
Hi,
I've got problem with file download. I've tested it and I think that problem might be on the server side, but I'm not sure.
My file has about 20MB, so it's rather big. File isn't corrupted because I've downloaded it via ftp. When I'm trying download it from my web page everything is fine, but I've noticed that in certain moment file is being saved on hard disk without finishing it. For example right now file has about 7,8 MB. It happens everytime when I'm trying to download something big from my webpage.
Did anybody have the same problem? How can I resolve it?
Posted: Tue 29. Aug 2006, 18:53
by Oliver Georgi
Check amount of memory for your PHP setting - maybe there are only 8 MB max_memory_limit set.
And what can happen too - that download needs longer than PHPs execution time. Often this is set to 30 seconds only.
Oliver
Posted: Tue 29. Aug 2006, 20:26
by st3fek
Thanks for reply, Oliver.
Well, I can't change anything because my account is on public web serwer and I don't have access to configuration files.
phpinfo() tells me that max_execution_time is 30 s. I found that putting the file into buffer will help, but it won't. Besides you've implemented very similiar script to that which I've tested - I mean this one when there isn't readfile function.
I've resolve this problem in a different way - when filesize is more than 8 MB script redirects directly to file. It gives you possibility to download a file, but file name is hashed so it dosn't looks well. It's only temorary solution, until I will find a better one, or someone give me a hint.
Posted: Tue 29. Aug 2006, 20:42
by Oliver Georgi
a not so good one would be to enhance the redirection a bit and implement a copy on server - for the copy you can use the real file name - and then redirect against that file. Before creating a copy make a check if the file still exists - will speed up everything.
Oliver
Posted: Tue 29. Aug 2006, 21:00
by st3fek
Well, good hint. Thx. I'll try to use it, but it won't be so good for space on web server, especially when theres not only one file this size - for example let it be 5 files for 20 MB, so when I make a copy there will be 200 MB of occupied space. I am thinking about fake files which will have few kB, but theres a problem too. Such file will be download without any problems and there won't be necessery to put a right file. In that case I would have to cheat the script. I must think about it...
Posted: Tue 29. Aug 2006, 21:15
by Oliver Georgi
Yes thats right.
Oliver