rahulvicky00 Posted January 28, 2012 Share Posted January 28, 2012 When i am uploading under 2 MB file, it is successfully uploaded but when i am trying to upload bigger file then its showing failed to upload issue... my code is following....please help me to get out of this situation... <?php function UploadOne($fname) { $uploaddir = 'uploadedfiles/'; if (is_uploaded_file($fname['tmp_name'])) { $filname = basename($fname['name']); $uploadfile = $uploaddir . basename($fname['name']); if (move_uploaded_file ($fname['tmp_name'], $uploadfile)) $res = "File " . $filname . "was successfully uploaded and stored. Upload More<br>"; include ('../config.php'); mysql_query("INSERT INTO videos (id, path, name, title, content) VALUES ('$_POST[id]', 'url/$filname', '$_POST[date]', '$_POST[title]' , '$_POST[content]')"); $data = mysql_query('SELECT * FROM videos ORDER BY id DESC LIMIT 1'); $info = mysql_fetch_array($data); $res = "<strong>$info[title]</strong>," . "\n Sucessfully Uploaded. \n Upload more". "<br>" . "<a href='../videos.php'>View Videos</a>"; } else $res = "File ".$fname['name']." failed to upload."; return ($res); } ?> Thanks in advance... Quote Link to comment https://forums.phpfreaks.com/topic/255931-need-help-in-uploading-videos-of-big-size-files/ Share on other sites More sharing options...
Pikachu2000 Posted January 28, 2012 Share Posted January 28, 2012 Have you checked to see if any error codes are present in the $_FILES array? Quote Link to comment https://forums.phpfreaks.com/topic/255931-need-help-in-uploading-videos-of-big-size-files/#findComment-1311945 Share on other sites More sharing options...
cool.works Posted January 28, 2012 Share Posted January 28, 2012 check your php.ini configuration file such as : php_value upload_max_filesize 10M php_value post_max_size 10M php_value max_input_time 300 php_value max_execution_time 300 you can define the constraints within your PHP application: ini_set('upload_max_filesize', '10M'); ini_set('post_max_size', '90M'); ini_set('max_input_time', 300); ini_set('max_execution_time', 300); hope that helps you Quote Link to comment https://forums.phpfreaks.com/topic/255931-need-help-in-uploading-videos-of-big-size-files/#findComment-1311953 Share on other sites More sharing options...
rahulvicky00 Posted January 29, 2012 Author Share Posted January 29, 2012 By default, PHP allow a maximum file upload of 2MB. You can increase the limit when necessary. Two PHP configuration options control the maximum upload size: upload_max_filesize and post_max_size. Both can be set to, say, “10M” for 10 megabyte file sizes. Remember, PHP scripts normally time-out after 30 seconds, but a 10MB file would take at least 3 minutes to upload on a healthy broadband connection. So you need to set PHP’s max_input_time and max_execution_time to something like 300 (5 minutes specified in seconds). You can set these options 3 way - Set in your server’s php.ini configuration file so that they apply to all your applications. upload_max_filesize = 10M post_max_size = 10M max_input_time = 300 max_execution_time = 300 Set in your code. ini_set('upload_max_filesize', '10M'); ini_set('post_max_size', '10M'); ini_set('max_input_time', 300); ini_set('max_execution_time', 300); If you’re using Apache, you can configure the settings in your application’s .htaccess file php_value upload_max_filesize 10M php_value post_max_size 10M php_value max_input_time 300 php_value max_execution_time 300 This seems very helpful information, but there is one confusion... where to find the php.ini file on the server. i am using window hosting for the website and using tomcat server... Quote Link to comment https://forums.phpfreaks.com/topic/255931-need-help-in-uploading-videos-of-big-size-files/#findComment-1312127 Share on other sites More sharing options...
Pikachu2000 Posted January 29, 2012 Share Posted January 29, 2012 Have you checked yet to see what, if any, errors are present? Quote Link to comment https://forums.phpfreaks.com/topic/255931-need-help-in-uploading-videos-of-big-size-files/#findComment-1312173 Share on other sites More sharing options...
rahulvicky00 Posted January 30, 2012 Author Share Posted January 30, 2012 yes i have checked but there is no error.... Quote Link to comment https://forums.phpfreaks.com/topic/255931-need-help-in-uploading-videos-of-big-size-files/#findComment-1312457 Share on other sites More sharing options...
AyKay47 Posted January 30, 2012 Share Posted January 30, 2012 By default, PHP allow a maximum file upload of 2MB. You can increase the limit when necessary. Two PHP configuration options control the maximum upload size: upload_max_filesize and post_max_size. Both can be set to, say, “10M” for 10 megabyte file sizes. Remember, PHP scripts normally time-out after 30 seconds, but a 10MB file would take at least 3 minutes to upload on a healthy broadband connection. So you need to set PHP’s max_input_time and max_execution_time to something like 300 (5 minutes specified in seconds). You can set these options 3 way - Set in your server’s php.ini configuration file so that they apply to all your applications. upload_max_filesize = 10M post_max_size = 10M max_input_time = 300 max_execution_time = 300 Set in your code. ini_set('upload_max_filesize', '10M'); ini_set('post_max_size', '10M'); ini_set('max_input_time', 300); ini_set('max_execution_time', 300); If you’re using Apache, you can configure the settings in your application’s .htaccess file php_value upload_max_filesize 10M php_value post_max_size 10M php_value max_input_time 300 php_value max_execution_time 300 This seems very helpful information, but there is one confusion... where to find the php.ini file on the server. i am using window hosting for the website and using tomcat server... use phpinfo to find the location of the correct php.ini file, and then check the relevant settings. Quote Link to comment https://forums.phpfreaks.com/topic/255931-need-help-in-uploading-videos-of-big-size-files/#findComment-1312560 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.