Posts: 715
Name: John
Location: United States of America, California
|
This is an upload script which then converts the uploaded format of the video to flv and a still frame as a jpg. I know want to make it so that the script will write the information to a mysql table know that the information is done.
I have some idea of the insert code, but I am unsure of how to implement it in the current script:
PHP Code:
$sql = 'INSERT INTO `forbushj_onetest`.`video` (`id`, `title`, `descr`, `pic`, `locat`, `src`) VALUES (\'222\', \'test\', \'test\', \'test.jpg\', \'test.flv\', \'http://test.com\');'
table item id is the number id of the movie and needs to be one number higher then the previous movie
table item title is the title of the movie.
table item descr isthe description of the movie
table item pic is the filename without the path of the screenshot jpeg
table item locat is the filename of the video without the path
table item src is the creator of the videos website
PHP Code:
<?php //home/forbushj/www/vidtemp/ $target = "vidtemp/"; $target = $target . basename( $_FILES['uploaded']['name']) ; $ok=1; $output .= date("Y-m-d-H-i-s")
//This is our size condition if ($uploaded_size > 350000) { echo "Your file is too large.<br>"; $ok=0; }
//This is our limit file type condition if (!($uploaded_type=="video/x-ms-asf")) { echo "You may only upload movies.<br>"; $ok=0; }
//Here we check that $ok was not set to 0 by an error if ($ok==0) { Echo "Sorry your file was not uploaded"; }
//If everything is ok we try to upload it else { if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { //COnvert the video //echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; exec('ffmpeg -i '. basename( $_FILES['uploadedfile']['name']).' -an -ss 00:00:03 -t 00:00:01 -r 1 -y -s 150x100 -f mjpeg /home/forbushj/www/pic/video/'.$output.'.jpg'); exec('ffmpeg -i '. basename( $_FILES['uploadedfile']['name']).' -ar 22050 -ab 32 -f flv -s 320x240 /home/forbushj/www/vidd/'.$output.'.flv'); } else { echo "Sorry, there was a problem uploading your file."; } } ?>
Last edited by goheadtry : 06-01-2008 at 05:11 PM.
|