Page 1 of 1

Downloading File via PHP

Posted: Mon Jul 25, 2005 1:52 am
by aicfan4@yahoo.com
I've found some examples of how to upload a file via PHP, for instance: http://us2.php.net/features.file-upload, however I need to be able to download a file from a server using PHP. Does anyone have a good tutorial page to point me to, or offer any suggestions on this subject? Thanks.

Posted: Mon Jul 25, 2005 8:08 am
by hawleyjr
Yes, use

Code: Select all

header()

Posted: Mon Jul 25, 2005 8:10 am
by timvw

Posted: Mon Jul 25, 2005 8:24 am
by smo

Posted: Mon Jul 25, 2005 1:12 pm
by josh
Or did he want to do this?

Code: Select all

<?
$file="http://example.org/files/data.zip";

$data=file_get_contents($file);
$h = fopen ("/example/path/data.zip", "w");
fwrite($h, $data);
fclose($h);
?>