Downloader Script

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Xerpher
New php-forum User
New php-forum User
Posts: 164
Joined: Tue Aug 27, 2002 8:25 pm
Location: Ontario, Canada
Contact:

Downloader Script

Postby Xerpher » Thu Mar 13, 2003 6:47 pm

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

Code: Select all

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.

Xerpher
New php-forum User
New php-forum User
Posts: 164
Joined: Tue Aug 27, 2002 8:25 pm
Location: Ontario, Canada
Contact:

Postby Xerpher » Fri Mar 14, 2003 12:41 pm

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?


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 1 guest

cron