php - Url Download to Server 500 Error after long time -
i'm using fopen , fwrite download url files (zip,rar etc) direct server, if file large or takes long time download returns 500 error.
php
$destination_folder = 'files/'; $url = $_post['url']; $newfname = $destination_folder . basename($url); $file = fopen ($url, "rb"); if ($file) { $newf = fopen ($newfname, "wb"); if ($newf) while(!feof($file)) { fwrite($newf, fread($file, 1024 * 8 ), 1024 * 8 ); } } if ($file) { fclose($file); } if ($newf) { fclose($newf); }
Comments
Post a Comment