Vous êtes sur la page 1sur 1

function save_file($url, $path) {

$file = file_get_contents($url);
$file_path = parse_url($url);
$file_path_parts = pathinfo($file_path['path']);
$filename = $file_path_parts['filename'];
$file_ext = $file_path_parts['extension'];
//$path = "img/";
$filex = $path . $filename . "." . $file_ext;
$filex = $path; //
$fh = fopen($filex, 'w');
fputs($fh, $file);
fclose($fh);
return filesize($filex);
}