Has anyone ever seen or made a php script that you enter a url of an image, and it automaticly uploads it to a location on your server? It would save a ton of time for me.
| SitePoint Sponsor |
Has anyone ever seen or made a php script that you enter a url of an image, and it automaticly uploads it to a location on your server? It would save a ton of time for me.
Yes, 1 second
Oh sorry I have a local script, not a url, Any help?





I created something similar a while back for someone who needed to change four images regularly. You may be able to tweak it.
Here are links to the files:
replaceImg.php
imageFunctions.php
showImages.php
blank.gif
You'll have to rename the files with a .php extension when downloaded (I didn't want them active as I haven't checked how secure this method is). Then put all three files in the same directory and load replaceImg.php.
showImages.php is included for completeness, but displays the images in a way that is no use to anyone but the intended client.
Hope it helps,
Andy
From the English nation to a US location.

try somthing like
PHP Code:<?
$dest_folder = "/uploads";
if (!$_POST['url'])
{
echo '<form method="post">';
echo ' <input type="text" name="url" value="http://"/>';
echo ' <input type="submit" value="Get File"/>';
echo '</form>';
} else {
$file = file_get_contents($POST['url']);
file_put_contents($dest_folder.'/'.rand(0,100));
}
?>
Sory for the long reply but:
Fatal error: Call to undefined function: file_put_contents() in admin/urlupload.php on line 18
How do I define it?
EDIT: Found out why, I have PHP Version 4.3.11 I need PHP Version 5 to use that function.
Now how to upgrade it.............
Bookmarks