upload video convert it to flv and then move the file

Alles, was PHP betrifft, kann hier besprochen werden.

upload video convert it to flv and then move the file

Postby ebot » 07. June 2009 19:27

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, convertion done and store in the db the problem is to move the file to video folder at the root and the thumbnail also, here are the codes:

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());
}


i always get this error 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" :cry:
and the video and thumbnails files are not moved to the folders i'd want,
i will appreciate any help and information. :D
thanks
Ebot Evans
ebot
 
Posts: 1
Joined: 07. June 2009 19:17

Return to PHP

Who is online

Users browsing this forum: No registered users and 6 guests