Downloading File via PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
aicfan4@yahoo.com
Forum Newbie
Posts: 1
Joined: Mon Jul 25, 2005 1:49 am

Downloading File via PHP

Post 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.
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Yes, use

Code: Select all

header()
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

smo
Forum Newbie
Posts: 20
Joined: Tue May 31, 2005 11:02 pm

Post by smo »

josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post 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);
?>
Post Reply