Retrieve video files in php from database

by Mohan 2012-09-17 15:47:17

if($_POST['submit'] == 'submit')
{
$filename = $_FILES['video']['name'];
$tmpname = $_FILES['video']['tmp_name'];
$source = "upload/"; // this is a
folder in our server or system
$distination = "upload/".$filename; // we are
uploading file in to our created folder

if($_FILES['video']['error'] == false)
{
move_uploaded_file($tmpname,$distination);
}

// using sql we are upload file name into database,
$sql = mysql_query("insert into file set filename =
'".$filename."' ");

if($sql)
{
echo "file uploaded to database successfully";
}
else
{
echo "Unable to upload file to database. ".mysql_error();
}

// Retriveing file from that database

$sql = mysql_query("select * from file");
$res = mysql_fetch_array();

echo "upload/".$res['filename']; //when you like to play
the video, you has to use Embed tag
}
?>

method="post" enctype="multipart/form-data">
name="submit" value="submit" />
834
like
0
dislike
0
mail
flag

You must LOGIN to add comments