Downloader Script

A

Anonymous

Guest
I have a downloader script which runs great with texts documents, but anything else gets corrupted. Can anyone see why?

Code:
header("Content-type: application/force-download");
header("Content-Disposition: attachment; filename=".stripslashes($_GET['filename']));
header("Content-length: ".filesize(stripslashes($_GET['dir'].$_GET['filename'])));
readfile(stripslashes($_GET['dir'].$_GET['filename']));

By the way, I've tried a few different Content-type's specific to the target file's format, application/octet-stream and the one above.
 
Here's an update: texts files and very small zip files don't get corrupted... nothing gets corrupted when used on my Unix server, but these problems happen on my home Windows server. Speed always starts at over a megabyte a second even though I can barely download 100 kilobytes in a second on my modem... so is there a setting in Apache that I need to restrict speed or something?
 
Back
Top