rajeshkr Posted April 22, 2014 Share Posted April 22, 2014 Hi,I create a simple code to upload file using php code. index.php <?php @ini_set('upload_max_filesize', '1024000000000M'); @ini_set('post_max_size', '1024000000000M'); @ini_set('max_input_time', 3600000000000); @ini_set('max_execution_time', 3600000000000); ?> <!doctype html> <head> <title>Proalbum: File Upload </title> <style> body { padding: 30px } form { display: block; margin: 20px auto; background: #87bb2f; border-radius: 10px; padding: 15px } .progress { position:relative; width:400px; border: 1px solid #ddd; padding: 1px; border-radius: 3px; background:#FF0000;} .bar { background-color:#87bb2f; width:0%; height:20px; border-radius: 3px; } .percent { position:absolute; display:inline-block; top:3px; left:48%; } </style> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <h1>Select a File to Upload</h1> <form action="video_upload.php" method="post" enctype="multipart/form-data"> <input type="file" name="uploadedfile"><br> <input type="submit" value="Upload File"> <input type="hidden" name="MAX_FILE_SIZE" value="99999999"/> </form> <div class="progress"> <div class="bar"></div > <div class="percent">0%</div > </div> <div id="status"></div> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script> <script src="http://malsup.github.com/jquery.form.js"></script> <script> (function() { var bar = $('.bar'); var percent = $('.percent'); var status = $('#status'); $('form').ajaxForm({ beforeSend: function() { status.empty(); var percentVal = '0%'; bar.width(percentVal) percent.html(percentVal); }, uploadProgress: function(event, position, total, percentComplete) { var percentVal = percentComplete + '%'; bar.width(percentVal) percent.html(percentVal); }, complete: function(xhr) { bar.width("100%"); percent.html("100%"); status.html(xhr.responseText); } }); })(); </script> </body> </html> video_upload.php <?php @ini_set('upload_max_filesize', '1024000000000M'); @ini_set('post_max_size', '1024000000000M'); @ini_set('max_input_time', 3600000000000); @ini_set('max_execution_time', 3600000000000); //$upload_dir = $_SERVER['DOCUMENT_ROOT'] . dirname($_SERVER['PHP_SELF']); $upload_dir='rajesh'; $upload_url = '/'; $temp_name = $_FILES['uploadedfile']['tmp_name']; $file_name = $_FILES['uploadedfile']['name']; $file_path = $upload_dir.$upload_url.$file_name; if(move_uploaded_file($temp_name, $file_path)) { echo "File uploaded Success !"; } ?> and php.inimax_execution_time: 3600000000000max_input_time 3600000000000post_max_size 1024000000000Mupload_max_filesize 1024000000000Mand in .htaccess filephp_value max_execution_time 3600000php_value max_input_time 3600000php_value post_max_size 1024000Mphp_value upload_max_filesize 1024000MBut still can't able to upload file more than 20 mb.Can anyone please help me in this.Thanks Quote Link to comment https://forums.phpfreaks.com/topic/287933-php-upload-problem/ Share on other sites More sharing options...
bsmither Posted April 22, 2014 Share Posted April 22, 2014 (edited) Do you have control over the web server's (Apache?) configuration file? If so, study the LimitRequestBody parameter. Be aware that too many players in this process hold filesizes and limits in an integer field. So some of these (ridiculously large) limuts will be ignored because they are greater than what a 32-bit integer can hold. Edited April 22, 2014 by bsmither Quote Link to comment https://forums.phpfreaks.com/topic/287933-php-upload-problem/#findComment-1476947 Share on other sites More sharing options...
ginerjm Posted April 22, 2014 Share Posted April 22, 2014 1 - I wonder why you suppress the outcome of your ini-set statements? What are you hiding from yourself / the user? If anything, during development you WANT to see if there is an unexpected outcome, no? 2 - this line: ini_set('upload_max_filesize', '1024000000000M'); is asking for an inordinately HUGE filesize. The M indicates megabytes already, so why so many zeros? Don't you just want ini_set('upload_max_filesize', '20M'); I wonder if #1 is preventing you from seeing an error message caused by #2? Quote Link to comment https://forums.phpfreaks.com/topic/287933-php-upload-problem/#findComment-1476952 Share on other sites More sharing options...
rajeshkr Posted April 23, 2014 Author Share Posted April 23, 2014 Do you have control over the web server's (Apache?) configuration file? If so, study the LimitRequestBody parameter. Be aware that too many players in this process hold filesizes and limits in an integer field. So some of these (ridiculously large) limuts will be ignored because they are greater than what a 32-bit integer can hold. Can you please tell me what is the name of that file, i have access to my control panel. and as i said i have changed my php.ini file as said in forums and where i search for solution but still no luck. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/287933-php-upload-problem/#findComment-1477040 Share on other sites More sharing options...
rajeshkr Posted April 23, 2014 Author Share Posted April 23, 2014 1 - I wonder why you suppress the outcome of your ini-set statements? What are you hiding from yourself / the user? If anything, during development you WANT to see if there is an unexpected outcome, no? 2 - this line: ini_set('upload_max_filesize', '1024000000000M'); is asking for an inordinately HUGE filesize. The M indicates megabytes already, so why so many zeros? Don't you just want ini_set('upload_max_filesize', '20M'); I wonder if #1 is preventing you from seeing an error message caused by #2? Hi, This is the error, 500 Server Error A misconfiguration on the server caused a hiccup. Check the server logs, fix the problem, then try again. secondly I want to upload between 300 MB to 500 MB file. not 20 MB. its was just to give maximum file size that's why so many zeros , i put there. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/287933-php-upload-problem/#findComment-1477041 Share on other sites More sharing options...
jazzman1 Posted April 23, 2014 Share Posted April 23, 2014 I want to upload between 300 MB to 500 MB file. not 20 MB. its was just to give maximum file size that's why so many zeros , i put there. You need to send the file or a group of large files "chunking" uploads into small pieces of data and send it to the file server via ajax methods. Plupload and others similar JS libraries can do that for you. Quote Link to comment https://forums.phpfreaks.com/topic/287933-php-upload-problem/#findComment-1477050 Share on other sites More sharing options...
rajeshkr Posted April 25, 2014 Author Share Posted April 25, 2014 hi, I have change the php.ini from 5.2 to 5.4 and change display error on then i am getting this error. Notice: Undefined index: uploadedfile in /home1/proalbu1/public_html/file-upload-progress-bar/video_upload.php on line 14 this is the line no 14 contains $temp_name = $_FILES['uploadedfile']['tmp_name']; Can you please suggest what to do now? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/287933-php-upload-problem/#findComment-1477249 Share on other sites More sharing options...
ginerjm Posted April 25, 2014 Share Posted April 25, 2014 If you look at the manual under $_FILES there is a user-added note concerning exactly this issue. Apparently you haven't provided a file to be uploaded, so the FILEs array isn't created. Quote Link to comment https://forums.phpfreaks.com/topic/287933-php-upload-problem/#findComment-1477266 Share on other sites More sharing options...
rajeshkr Posted April 26, 2014 Author Share Posted April 26, 2014 If you look at the manual under $_FILES there is a user-added note concerning exactly this issue. Apparently you haven't provided a file to be uploaded, so the FILEs array isn't created. Hi ginerjm, Is your answer for Undefined index: then it is solved now by simply increasing the size in php.ini. but the main 500 server error still coming. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/287933-php-upload-problem/#findComment-1477328 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.