HTML5 form upload file with php getting errors over a certain MB filesize -
i've spent 10 hours trying make large video uploads work:
i've made form submits sql database uploading file folder on server. works except files on 110mb or so, need @ 300m. form looks like
<input type="hidden" name="max_file_size" value="800024288"> <input type="file" name="video_upload" required>
and php.ini has following values, confirmed phpinfo()
upload_max_filesize = 300m post_max_size = 300m memory_limit = 2048m max_execution_time = 1200 max_input_time = 1200
is there i'm forgetting? i've turned these limits high try make work. first programming project i'm not yet advanced enough use more sophisticated techniques. possible there's apache configuration timeout error or going wrong? time
edit
i'm getting 'this webpage not available' (err_connection_aborted) php code
<?php // not working - error_reporting(e-all); //defining db access info constants define ('db_user', 'devuser1'); define ('db_password', 'forreal11!'); define ('db_host', 'localhost'); define ('db_name', 'subdb'); //make connection db $dbc = @mysqli_connect (db_host, db_user, db_password, db_name) or die ('could not connect mysql: ' . mysqli_connect_error() ); //define pic name variable $upload_name=basename( $_files['upload']['name']); $video_upload_name=basename( $_files['video_upload']['name']); require_once 'validate_apptest.php'; //form insert query $q = "insert applicants ( first_name, middle_name, last_name, dob, email, address, city, state, zip, htel, ctel, wtel, occ, jtitle, gender, relstatus, children, education, tv, tv_name, haveweb, usersite, filename, videoname, para ) values ( '$fn', '$mn', '$ln', '$dob', '$email', '$address', '$city', '$state', '$zip', '$htel', '$ctel', '$wtel', '$occ', '$jtitle', '$gender', '$relstatus', '$children', '$education', '$tv', '$tv_name', '$haveweb', '$usersite', '$upload_name', '$video_upload_name', '$para' )"; $r = @mysqli_query ($dbc, $q); //if success! if ($r) { include_once 'file_upload.php'; include_once 'video_upload.php'; include_once 'email_alertnew.php'; } //set encoding mysqli_set_charset($dbc, 'utf8'); mysqli_close($dbc); ?>
file_upload.php script
<?php # 6.14 current file upload script // check if form submitted: if ($_server['request_method'] == 'post') { //check uploaded file if (isset($_files['upload'])) { //validate type - should jpeg or png $allowed = array ('image/pjpeg', 'image/jpeg', 'image/jpg', 'image/x-png', 'image/png', 'image/png', 'image/x-png', 'video/mp4', 'video/mp4' ); if (in_array($_files['upload']['type'], $allowed)) { //move file on if (move_uploaded_file($_files['upload']['tmp_name'], "../uploads/{$_files['upload']['name']}")) { // echo 'file uploaded'; } // end of move if } else { // invalide type echo '<p>please upload jpeg or png image</p>'; } } // end of isset //check error if ($_files['upload']['error'] > 0) { echo 'file not uploaded because: <strong>'; // print message based on error switch ($_files['upload']['error']) { case 1: print 'the file exceeds upload max filesize setting in phpini'; break; case 2: print 'the file exceeds upload max filesize setting in html form'; break; case 3: print 'the file partially uploaded'; break; case 4: print 'no file uploaded'; break; case 6: print 'no temp folder'; break; case 7: print 'unable write disc'; break; case 8: print 'file upload stopped'; break; default: print 'a system error occurred'; break; } // end of switch print '</strong></p>'; } // end of error if //delete file if still exists if (file_exists($_files['upload']['tmp_name']) && is_file($_files['upload']['tmp_name']) ) { unlink ($_files['upload']['tmp_name']); } } // end of submitted conditional ?>
video_upload.php:
<?php // check if form submitted: if ($_server['request_method'] == 'post') { //check uploaded file if (isset($_files['video_upload'])) { //validate type - should jpeg or png $allowed = array ('image/pjpeg', 'image/jpeg', 'image/jpg', 'image/x-png', 'image/png', 'image/png', 'image/x-png', 'video/mp4', 'video/mp4' ); if (in_array($_files['video_upload']['type'], $allowed)) { //move file on if (move_uploaded_file($_files['video_upload']['tmp_name'], "../uploads/{$_files['video_upload']['name']}")) { //echo 'video uploaded'; } // end of move if } else { // invalide type echo '<p>please upload jpeg or png image</p>'; } } // end of isset //check error if ($_files['video_upload']['error'] > 0) { echo 'file not uploaded because: <strong>'; // print message based on error switch ($_files['video_upload']['error']) { case 1: print 'the file exceeds upload max filesize setting in phpini'; break; case 2: print 'the file exceeds upload max filesize setting in html form'; break; case 3: print 'the file partially uploaded'; break; case 4: print 'no file uploaded'; break; case 6: print 'no temp folder'; break; case 7: print 'unable write disc'; break; case 8: print 'file upload stopped'; break; default: print 'a system error occurred'; break; } // end of switch print '</strong></p>'; } // end of error if //delete file if still exists if (file_exists($_files['video_upload']['tmp_name']) && is_file($_files['video_upload']['tmp_name']) ) { unlink ($_files['video_upload']['tmp_name']); } } // end of submitted conditional ?>
thanks again looking @ it, sorry code not you're used =)
Comments
Post a Comment