Monday, May 20, 2013

upload server image in local disk using php



<?php
function img_url()
{

$num=rand(1,99999999999999999999)-rand(5000,8585858571);
$urls=$_SERVER['REMOTE_ADDR'];
$ip=$_SERVER['HTTP_HOST'];

$filename=$num."_".$urls;
$img = 'img/'.$filename.'.jpg';
file_put_contents($img, file_get_contents($url));
$file_location='http://www.'.$ip.'/'.$img;

//echo $file_location;

//echo '<img src="'.$file_location.'" height="auto" width="auto" style="border:0px solid green" />';
echo '
<img src="'.$url.'" />
';
}

img_url();

?>

No comments:

Post a Comment