Hii,

I am new to PHP world. I need to convert the video files into flv format.
I am having a problem in the code. Its not working. I dont know whats the problem. It gives error " Parse error: parse error in \script\uploadvideopro.php on line 63 "

Here is my code

<?php
$extension = "ffmpeg";
$extension_soname = $extension . "." . PHP_SHLIB_SUFFIX;
$extension_fullname = "/php5.3.5/ext" . "/" . $extension_soname; 
           
/*****************Get the path to Extention ****************/
$array_path = explode("/",$_SERVER['SCRIPT_FILENAME']);
$dynamic_path = "";
for ($i=0;$i<sizeof($array_path)-1;$i++)
if($array_path[$i]!="")
$dynamic_path =$dynamic_path."/".$array_path[$i];
/******************set folders*****************************/
$flvpath = "C:/flvfiles";
$moviepath = "C:/movies" ;
//chmod($moviepath,0777);
//chmod($flvpath,0777);
/******************Upload and convert video *****************************/
if(isset($_FILES['cert_file']))
{
echo "<pre>".print_r($_FILES, true) . "</pre><br/>";
$fileName = $_FILES["cert_file"]["name"];
$fileNameParts = explode( ".", $fileName );
$fileExtension = end( $fileNameParts );
$fileExtension = strtolower( $fileExtension );
if(isset($_FILES['cert_file']))
{
if($fileExtension=="avi" || $fileExtension=="wmv" || $fileExtension=="mpeg"|| $fileExtension=="mpg" || $fileExtension=="mov" )
{
if ( move_uploaded_file($_FILES["cert_file"]["tmp_name"],$moviepath.$_FILES["cert_file"]["name"]))
{
  if( $fileExtension == "wmv" ) 
  {
      exec("ffmpeg -i ".$dynamic_path."/".$moviepath."".$fileName." -sameq -acodec mp3 -ar 22050 -ab 32 -f flv -s 320x240 ".$dynamic_path."/".$flvpath."myflv.flv");
  }
if( $fileExtension == "avi" || $fileExtension=="mpg" || $fileExtension=="mpeg" || $fileExtension=="mov" )
{
  exec("ffmpeg -i ".$dynamic_path."/".$moviepath."".$fileName." -sameq -acodec mp3 -ar 22050 -ab 32 -f flv -s 320x240 ".$dynamic_path."/".$flvpath."myflv.flv");

}
/******************create thumbnail***************/
exec("ffmpeg -y -i ".$dynamic_path."/".$moviepath."".$fileName." -vframes 1 -ss 00:00:03 -an -vcodec png -f rawvideo -s 110x90 ".$dynamic_path."/".$flvpath."myflv.png");
}
else
{
die("The file was not uploaded");
}
}
else
{
die("Please upload file only with avi, wmv, mov or mpg extension!");
}
}
else
{
die("File not found");
}
?>    //line number 63

I am not getting where is the problem...Any advice will be highly appreciated.

Thanks in advance

It looks like you might be missing a } at the end of the code, so it is getting confused when you suddenly end the php. I find it always helps to hit tab when starting a new block of code, so you can keep track of where you are up to :)

Member Avatar for diafol

Ditto. Indenting your lines will help keep track of the brackets.

if(){
   if(){
      
   }elseif(){

   }else{
      if(){

      }
   }
}

Something like that?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.