Forum Moderators: coopster

Message Too Old, No Replies

upload video files

upload video files

         

vivek avasthi

5:39 pm on Oct 5, 2007 (gmt 0)

10+ Year Member



hi
i am facing problem in uploading video files which is more than 5 mb i want to upload files in range of 5 to 100 mb . can someone help me.
if i try to upload file with normal php script i got error .

can some one help me.

PHP_Chimp

5:43 pm on Oct 5, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What is the script you are using? And what is the error you are getting?

vivek avasthi

5:51 pm on Oct 5, 2007 (gmt 0)

10+ Year Member



using normal php script but my browser got hanged when i try to upload file around 50 mb. i need a script who help me to upload larger video files?

PHP_Chimp

6:05 pm on Oct 5, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What 'normal' script....<?php echo 'hello world';?> Im sure we all had that somewhere in the past ;)
Are you using fwrite to put the file on the server or adding your video file to a database? Are you using php's FTP side to upload files to your server? Are you getting the file from another site or is the file being input through the browser?

The problem could be an error in the script or it could be something making your browser or server time-out, it may be file permissions or other issues. We need a little bit more info about the script and problem.

If your code is short why dont you post it so we know what you are doing.
Also if you are getting an error then copy that error and post that as well.

dreamcatcher

6:25 pm on Oct 5, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Does your PHP settings allow large file uploads? In your PHP.ini file, you should increase the following values:

upload_max_filesize
post_max_size

dc

vivek avasthi

4:48 am on Oct 6, 2007 (gmt 0)

10+ Year Member



i am using below posted code. its working fine but when i try to upload more than 10 mb file the connection got disconnect.

can u people have any better script which help me to doing it in better way .

need help?

<?php
@ini_set("max_execution_time","5000");
define(VIDEO_FILE_PATH,$arrConfig['sourceRoot'].'common/uploaded_files/');// define path here
define(MAX_IMAGE_SIZE,'104857600');// 100 mb
$_SESSION['varUploadMsg']='';
define(VIDEO_FILE_PATH,$arrConfig['sourceRoot'].'common/uploaded_files/');// define path here
define(MAX_IMAGE_SIZE,'104857600');// 100 mb
//$varVideoFileSize=round($_FILES[frmVideoFile]['size'] /(1024 * 1024),2);
$varMaxImageSize = MAX_IMAGE_SIZE;
//**** files check
$varVideoFileName = $_FILES['frmFileUpload']['name'];
$varVideoFileType = $_FILES['frmFileUpload']['type'];

$varVideoFileSize = $_FILES['frmFileUpload']['size'];
$varVideoUploadFileName = $_FILES['frmFileUpload']['tmp_name'];
//*** other files check

if($varVideoFileSize > 0 && is_uploaded_file($varVideoUploadFileName))
{

if($varVideoFileSize > $varMaxImageSize)
{
$varErrorMsg = 'Image size must be less than 100MB.';
$_SESSION['varUploadMsg'] = $varErrorMsg;

}
//echo strrchr($varVideoFileName,'.');

if($varErrorMsg == '')
{
if (file_exists(VIDEO_FILE_PATH.$varVideoFileName))
{
srand((double)microtime()*1000000); // random number inizializzation
$varVideoFileName = rand(0,20000).$varVideoFileName; // add number to file name
}
//echo $varVideoUploadFileName.":".VIDEO_FILE_PATH.$varVideoFileName."";
if (!@move_uploaded_file ($varVideoUploadFileName,VIDEO_FILE_PATH.$varVideoFileName) )
{
$varErrorMsg = "video file can not copy to".VIDEO_FILE_PATH.".";
$_SESSION['varUploadMsg'] = $varErrorMsg;exit;
}
else
{
$varSuccessMsg ="Video file has been uploaded successfully";
$_SESSION['varUploadMsg'] = $varSuccessMsg;
exit;
}
}
}
?>

phranque

11:51 am on Oct 6, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



http is not a very efficient file transfer protocol especially so on the upload.
it is very typical for the file upload to start becoming unreliable in the 10M range.
i would guess that process size and paging issues and timeouts are your primary problems.

is ftp an option?

dreamcatcher

7:01 am on Oct 7, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



vivek avasthi, did you read my previous post?

dc