Page 1 of 1

a converted flv to be moved the file to a folder

Posted: Sun Jun 07, 2009 3:48 am
by ebot
i got a problem moving the converted flv and thumbnail photo to the folder in the root directory;
here are my codes that does the convertions, everything is fine, convertioin done and store in the db:

Code: Select all

 
$ffmpegpath = "../tool/ffmpeg.exe";
 
function converttoflv( $in, $out )
{
  unlink( $out );
  $cmd = "$ffmpegpath -v 0 -i $in -ar 11025 $out 2>&1";
  $fh = popen( $cmd, "r" );
  while( fgets( $fh ) ) { }
  pclose( $fh );
}
 
function getthumbnail( $in, $out )
{
  unlink( $out );
  $cmd = "$ffmpegpath -i $in -pix_fmt rgb24 -vframes 1 -s 300x200 $out 2>&1";
  $fh = popen( $cmd, "r" );
  while( fgets( $fh ) ) { }
  pclose( $fh );
}
 
function flv_import( $upfile, $fname, $title )
{
  $fname = preg_replace( '/\..*$/', '', basename( $fname ) );
  $target = "../video/";
  $target = $target . basename( $_FILES['vid']['name']);
 
  $flvpath = "$fname.flv";
  $thumbpath = "$fname.gif";
 
  converttoflv( $upfile, "videos\\$flvpath" );
  getthumbnail( $upfile, "videos\thumbs\\$thumbpath" );
 
   $DateAdded = date("Y-m-d H:i:s");
  $sql = "INSERT INTO videos (name, thumb, video_path, eng, fr, ger, date_added) " .
            "VALUES (\"$title\", \"$thumbpath\", \"$flvpath\", \"$eng\", \"$fr\", \"$ger\", \"$DateAdded\")";
        $result = mysql_query($sql) or die("Error: " . mysql_error());
}
 
the problem now is , i get a message: "


Warning: unlink(videos\29052009012.flv) [function.unlink]: No such file or directory in C:\xampp\htdocs\toura\internal\video.php on line 16

Warning: unlink(videos humbs\29052009012.gif) [function.unlink]: Invalid argument in C:\xampp\htdocs\toura\internal\video.php on line 25" crazy.gif

and the video and thumbnails files are not moved to the folders i'd want,
i will appreciate any help and information. blink.gif
thanks
Ebot Evans