Jump to content

Need help in uploading videos of big size files


rahulvicky00

Recommended Posts

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...

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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 -
  1. 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
    


  2. 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);
    


  3. 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...

 

Link to comment
Share on other sites

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 -
  1. 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
    


  2. 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);
    


  3. 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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.