Jump to content

PHP File Server Download


mattkingston

Recommended Posts

Hi all.

 

Hope you can help me.

 

I have created a small php script that serves up a file to be downloaded, this works fine however, the estimated time left to download is unknown and i assume this is due to my script no containing the file size for web browsers to calculate the eta.

 

Can anyone help me with this?

 

its just a PDF of about 30MB but is important that those who download know the ETA.

 

many thanks.

Link to comment
https://forums.phpfreaks.com/topic/263995-php-file-server-download/
Share on other sites

Thanks for the info, im quite new to php so could you please explain how i enter in file size values and where i should enter it?

 

this is my current script to serve the file (2012.pdf)

whet should i add the extra line, my file size is 15.226KB, how do i translate this into the correct content length?

 

<?php

header('Content-disposition: attachment; filename=2012.pdf');

header('Content-type: application/pdf');

readfile('2012.pdf');

?>[/blockquote>

 

thanks again.

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.