Jump to content

Sending with type application/binary only downloads 24,576 bytes


dptr1988

Recommended Posts

I made a php script for sending a file but it only sends the first 24,576 bytes. This is the code:

[code]
header('Content-type:  application/binary');
header('Content-Disposition: attachment; filename='.$_GET['fname']);
readfile($filedir.$_GET['fname']);
[/code]

Then run the script with "send_file.php?fname=filename.jpg" and everything is normal except that the file is limited to 24,576 bytes. Do I need to change a setting in my php.ini?
Thanks
I sent the Content-Length header and now the files are the right size. But now there is garbage in the files. I made a file full of zeros and tried downloading it and there are a whole lot of other numbers besides zero. And it's not readable text or anything that looks good. It just looks like random numbers. Am I useing the wrong content type for a binary file?

BTW here's the way I'm sending the Content-Length header:
[code]
header('Content-Length: '.filesize($filedir.$_GET['fname']));
[/code]

Thanks

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.