Мои эксперименты
<?php
$url=$_POST['file' ];
$info_url = pathinfo($url);
$whitelist = array ('jpg' , 'JPG' , 'jpeg' , 'JPEG' , 'gif' , 'GIF' , 'png' , 'PNG' );
$dir = '../files/images' ;
if (!empty ($_POST['sends' ])) {
$ext = $info_url['extension' ];
if (preg_match('/php/i' , $name) || preg_match('/pl/i' , $name) || $name == 'htaccess' || !in_array($ext, $whitelist)) {
$err2 .= 'Не верное расширение файла<br />' ;
}
if (isset ($err2)) echo '' .$err2.'' ;
if (empty ($err2)){
$name=$URL.'-' .rand(3 , 99999 ).'' .time().'.' .$ext;
copy($url, $dir.'/' .$name);
$size = filesize($dir.'/' .$name);
header('Location: ?' );
exit ;
}
}
echo '<div class="menu"><form method="POST" enctype="multipart/form-data">' ;
echo 'Файл:<br /><input type="text" name="file" value="http://" /><br />' ;
echo '<input type="submit" name="sends" value="Загрузить"/>' ;
echo '</form></div>' ;
?>