|
||||||
| PHP Forum Use this forum to discuss all aspects of PHP Development. PHP is a server-side, cross-platform, HTML embedded scripting language that lets you create dynamic web pages. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
Hey all,
I have a site that sells mp3's. The mp3 files are grouped; so the download is a zip file of about 70-100 MB. The zip files are in .htaccess protected directory of my webserver. The code i use to send the file to the client browser is the following: PHP Code:
so, the possible sources of the problem are: * the file is in an .htacces protected directory -- yet all other files download fine * the zip file is corrupted on ftp upload -- yet, if placed in another location within the server, the download is fine * the zip file is created with a lousy compressor -- windows, mac and linux compressors have been tried * the code to send the file is buggy -- yet all other files download fine Any insight on the true source of the problem and how it might be solved is greatly appreciated. Cheers |
| Sponsored Links |
|
|
|
|||||
|
Which browser are you using when the zip file is corrupted? Also, have you verified that it is not corrupt on the server?
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall |
|
|||||
|
How large is the corrupted file compared to the others? Are you actually sending the correct size? What do you headers look like on the download script? They should look similar to this:
PHP Code:
PHP Code:
PHP Code:
Here is some things you can do: 1) Download the file. Once complete open it with a text-editor and see if any text data is getting added to the beginning or ending of the file that shouldn't be there. 2) Does the file download when you link directly? If not, then it isn't your PHP script. You've corrupted the file somehow. 3) Try to use the php readfile function above and see if it is just your chunk function. 4) Make sure your headers are correct. I hope this helps. You can download the community project "ionFiles" here on CodeCall. If you look at the download.php file you can see how our PHP file download script works.
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall |
|
|||
|
WingedPanther: Yes, I have tried downloading with with Firefox for ubuntu, windows and mac. Same thing happens with IE7 and safari. And yes i have verified that the file is not corrupt on the server because if i move it outside the protected directory, the download is fine.
Jordan: thanks for the advice. because i'm selling downloads, i dont want anyone having a direct URL to them. that is why i'm using this script (which is part of virtuemart, btw) and a protected directory. all the files are of similar size. I just checked if there is an error message appended to the downloaded file, there is none. the file sizes are slightly different though, the downloaded file is smaller. Here is the code where i construct my headers (again, from virtuemart). it is very similar to the example you posted. PHP Code:
|
![]() |
| Tags |
| corrupt, download, zip |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Project: ionFiles - Joomla Simple File Download | Jordan | Community Projects | 290 | 06-28-2008 10:10 AM |
| Download a file | Lop | PHP Forum | 14 | 05-16-2008 12:07 PM |
| C#:Tutorial - Download Data | Xav | CSharp Tutorials | 9 | 04-23-2008 03:18 PM |
| Windows XP Tricks & Tips!!!!..new ones. | pranky | Tutorials, Classes and Code | 7 | 02-01-2007 10:58 PM |
| Easy way to download a file | Saint | Managed C++ | 5 | 09-11-2006 02:13 PM |