<?php
$imgPath = "/home/admin/domains/xyz.com/folder/"; //path where images are to be located
$baseurl = "http://xyz.com/folder/images/"; //the base path for images as a url (refer below)
//so if your images are supposed to be at http://domain.com/img/xyz.jpg then your baseurl is 'http://domain.com/img/' (with trailing slash)
//essentially, both the above paths should have something in similar with regards to folder structure
echo '<form enctype="multipart/form-data" action="" method="POST">';
echo '<textarea rows="10" cols="50" name="urls"></textarea>';
echo '<input type="submit" name="submit" value="submit" />';
echo '</form>';
if (isset($_REQUEST['submit']))
{
$urls = explode("\n", $_POST['urls']);
$imgarray = array();
foreach ($urls as $url)
{
$url = trim($url);
$imgname = basename($url);
$localimg = $imgPath . $imgname;
$img = file_get_contents($url);
file_put_contents($localimg, $img);
$url = $baseurl . $imgname;
$echo "$img <br />";
}
}
?>