Jump to content

save file to server from url


android6011

Recommended Posts

I am not sure if http://us2.php.net/manual/en/function.readfile.php would work, if it does work it would be done something like this:

 

<?php
$url = "http://www.somesite.com/new.jpg";

ob_start();
readfile($url);
$file = ob_get_contents();
ob_end_clean();

$fp = fopen('newfile.jpg', 'wb');
fwrite($fp, $file);
fclose($fp);
?>

 

I think you need the b there for binary, not sure. http://us2.php.net/manual/en/function.fopen.php for reference.

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.