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); } ?> Code (markup): Thanks in advance...
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 PHP: 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); PHP: 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 PHP:
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 IIS server...