[thelist] Sending File Size headers in PHP

Anthony Baratta Anthony at Baratta.com
Fri Oct 17 21:47:22 CDT 2003


At 03:44 PM 10/17/2003, Tony Grimes wrote:
>I've got a PHP download script that sends a file to the browser, but while
>it's downloading, the browser displays something like "25K of ?". Is there a
>way of telling the browser how big the file is?



>     // Give it a name.
>     header("Content-Disposition: attachment; filename=file.doc");

Tony....

$FileSize = filesize('/path/to/file.doc');
header("Content-Disposition: attachment; filename=file.doc; size=$FileSize;");

Hope that helps.
---
Anthony Baratta
President
Keyboard Jockeys

"Conformity is the refuge of the unimaginative."



More information about the thelist mailing list