hi guys,
I am having a bit of bother with my upload script.
The script runs fine for small files, 5,6,7 meg but as soon as i use a file 30 meg it stops working.
Max upload limit is 50meg
max_execution_time is 2400 // 40 minutes
max_input_time is 2400
I adjusted these settings because my upload speed sucks and a 30 meg file takes the best part of 20 minutes to upload.
I have already spent the best part of today trying to figure this out but i am now at a loss and out of time.
Below is the script and does work for smaller files.
i don’t know what else i can check
$upID = $_GET['upID'];
$upType = $_GET['upType'];
$upDate = date("Y-m-d h:i:s");
$movieName = strtolower($_FILES['Filedata']['name']);
$newName = substr($movieName, 0, -4);
$newMovie = "lesson_movie.flv";
$myLog = "../logs/".$upID."_logged.log";
$myHandle = fopen($myLog,'a');
$startTime = date("Y-m-d h:i:s");
//-------------------------------------------------------------
if($upType == "new"){
$logTxt = "************************* BEGIN $startTime ADD NEW*************************
";
fwrite($myHandle,$logTxt);
$xDestination = "../media/mentorMedia/temp_".$upID;
if(!is_dir($xDestination)){
mkdir ($xDestination);
}
if(move_uploaded_file($_FILES['Filedata']['tmp_name'], $xDestination."/".$movieName)){
//-------------------do conversion-------------------------------------------------//
$toexec = "D:\ffmpeg\bin\ffmpeg.exe -i D:\wwwroot\media\mentorMedia\ emp_".$upID."\\".$movieName." -r 15 -ar 22050 D:\wwwroot\media\mentorMedia\ emp_".$upID."\\".$newMovie;
$doWhat = "Convert ".$movieName." to ".$newMovie;
$logTxt = "Working on job $doWhat
";
fwrite($myHandle,$logTxt);
$logTxt = "Command to run: $toexec
";
fwrite($myHandle,$logTxt);
exec("$toexec",$output,$result1);
if($result1 == 0){
$logTxt = "
Successfully ran job $toexec
\r";
fwrite($myHandle,$logTxt);
$toexec2 = "D:\ffmpeg\bin\ffmpeg.exe -i D:\wwwroot\media\mentorMedia\ emp_".$upID."\\".$movieName." -ss 2 -vframes 1 -f mjpeg D:\wwwroot\media\mentorMedia\ emp_".$upID."\ humb_lesson.jpg";
exec("$toexec2",$output2,$result2);
if($result2 == 0){
$logTxt = "
Successfully ran $toexec2
\r";
fwrite($myHandle,$logTxt);
resizeImage($xDestination."/thumb_lesson.jpg", 320, 240, 100, $xDestination."/thumb_lesson.jpg", false);
unlink($xDestination."/".$movieName);
}else{
$logTxt = " Second execute failed: ".$toexec2."
\r";
fwrite($myHandle,$logTxt);
}
} else {
$logTxt = " First execute failed: ".$result1."
\r";
fwrite($myHandle,$logTxt);
}
$endTime = date("Y-m-d h:i:s");
$logTxt = "************************* END $endTime ADD NEW***************************
\r";
fwrite($myHandle,$logTxt);
fclose($myHandle);
}
}else if($upType == "replace"){
$classID = $_GET['classID'];
$lessonID = $_GET['lessonID'];
$xDestination = "../media/mentorMedia/classes/".$classID."/lesson_".$lessonID;
//
$del_1 = unlink($xDestination."/lesson_movie.flv");
$del_2 = unlink($xDestination."/thumb_lesson.jpg");
if(move_uploaded_file($_FILES['Filedata']['tmp_name'], $xDestination."/".$movieName)){
$logTxt = "************************* BEGIN $startTime REPLACE *************************
";
fwrite($myHandle,$logTxt);
//-------------------do conversion-------------------------------------------------//
$toexec = "D:\ffmpeg\bin\ffmpeg.exe -i D:\wwwroot\media\mentorMedia\classes\\".$classID."\\lesson_".$lessonID."\\".$movieName." -r 15 -ar 22050 D:\wwwroot\media\mentorMedia\classes\\".$classID."\\lesson_".$lessonID."\\".$newMovie;
$doWhat = "Convert ".$movieName." to ".$newMovie;
$logTxt = "Working on job $doWhat
";
fwrite($myHandle,$logTxt);
$logTxt = "Command to run: $toexec
";
fwrite($myHandle,$logTxt);
exec("$toexec",$output,$result1);
if($result1 == 0){
$logTxt = "
Successfully ran job $toexec
\r";
fwrite($myHandle,$logTxt);
$toexec2 = "D:\ffmpeg\bin\ffmpeg.exe -i D:\wwwroot\media\mentorMedia\classes\\".$classID."\\lesson_".$lessonID."\\".$movieName." -ss 2 -vframes 1 -f mjpeg D:\wwwroot\media\mentorMedia\classes\\".$classID."\\lesson_".$lessonID."\ humb_lesson.jpg";
exec("$toexec2",$output2,$result2);
if($result2 == 0){
$logTxt = "
Successfully ran $toexec2
\r";
fwrite($myHandle,$logTxt);
resizeImage($xDestination."/thumb_lesson.jpg", 100, 100, 100, $xDestination."/thumb_lesson.jpg", false);
unlink($xDestination."/".$movieName);
}else{
$logTxt = " Second execute failed: ".$toexec2."
\r";
fwrite($myHandle,$logTxt);
}
} else {
//Command failed
//Add result to logfile
$logTxt = " First execute failed: ".$result1."
\r";
fwrite($myHandle,$logTxt);
}
$endTime = date("Y-m-d h:i:s");
$logTxt = "************************* END $endTime REPLACE ***************************
\r";
fwrite($myHandle,$logTxt);
fclose($myHandle);
}
}