php - Upload larger file to server not working -
i got problem here upload larger file in server.i go through lot of related questions here still got same problem. increase necessary php.ini in server , when upload larger file 38mb system cannot upload it.what wrong here. please in advance.
$allowedexts = array("mp4", "mp4"); $extension = pathinfo($_files['file']['name'], pathinfo_extension); if ((($_files["file"]["type"] == "video/mp4") || ($_files["file"]["type"] == "video/mp4")) && in_array($extension, $allowedexts)) { if ($_files["file"]["error"] > 0) { echo "return code: " . $_files["file"]["error"] . "<br />"; } else { echo "upload: " . $_files["file"]["name"] . "<br />"; echo "type: " . $_files["file"]["type"] . "<br />"; echo "size: " . ($_files["file"]["size"] / 1024) . " kb<br />"; echo "temp file: " . $_files["file"]["tmp_name"] . "<br />"; if (file_exists('/home/hyborg/public_html/vimeo2/upload/' . $_files["file"]["name"])) { echo $_files["file"]["name"] . " exists. "; } else { move_uploaded_file($_files["file"]["tmp_name"], '/home/hyborg/public_html/vimeo2/upload/' . $_files["file"]["name"]); echo "upload success" . $_files["file"]["name"]; } } } else { echo "sorry wrong upload"; }
did make appropriate changes? upload_max_filesize
, post_max_size
also should change max_input_time
,as upload.php scripts time-out after 30 seconds.for larger files upload takes time.try increasing max_execution_time
500 (in sec).
then have define constraints within php application:
ini_set('upload_max_filesize', '10m'); ini_set('post_max_size', '10m'); ini_set('max_input_time', 300); ini_set('max_execution_time', 300);
php provides set_time_limit() function don’t need set max_execution_time directly.
setting options in php code possibly more practical, since can extend execution time , increase file size when application expecting large upload.
Comments
Post a Comment