Revision: 13488
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 26, 2009 05:32 by level09
Initial Code
function download($file_source, $file_target) { // prepare $file_source = str_replace(' ', '%20', html_entity_decode($file_source)); // fix url format if (file_exists($file_target)) chmod($file_target, 0777); // add write permission // opne files if (($rh = fopen($file_source, 'rb')) === FALSE) return false; // fopen() handles if (($wh = fopen($file_target, 'wb')) === FALSE) return false; // error messages. // read & write while (!feof($rh)) { if (fwrite($wh, fread($rh, 1024)) === FALSE) { // unable to write to file, possibly // because the harddrive has filled up fclose($rh); fclose($wh); return false; } } // close files fclose($rh); fclose($wh); return true; }
Initial URL
Initial Description
Initial Title
PHP Download/Copy File/Image
Initial Tags
php, image, file, download, copy
Initial Language
PHP