|
Posted by Rik on 05/20/06 18:29
funkychicken818@gmail.com wrote:
> Hey well i need help i want to create a simple image downloading
> script where you insert the image URL and it will download it and
> place it on your server, and rename the image to some number. Any one
> have any ideas on how i can do this?
"simple" and "place it on the server" don't really mix if you want the
script to be save (you could end up with malicious content on your
server...)
Without the security, your script could be like this though (PHP > 4.3.0):
$url = "http://some/url/of/image.jpg";
preg_match('"(\.[^/]+)$"', $url, $match);
$extension = (isset($match[1])) ? $match[1] : '';
$int = 'your_number';
$handle = fopen($url, 'r',);
copy($handle, '/path/on/your/server/'.$int.$extension);
Grtz,
--
Rik Wasmus
[Back to original message]
|