How to Retrieve video files in php from database.....and how
to store video on database..

Answer Posted / rajasekhar

it is same like how to store file's into database

<?php
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
}
?>

<form name="frm" action="<?php $_SERVER['PHP_SELF']; ?>"
method="post" enctype="multipart/form-data">
<input type="file" name="video" /><input type="submit"
name="submit" value="submit" />
</form>

Is This Answer Correct ?    17 Yes 22 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the definition of a session?

753


Which is better mysql or sql?

748


Does php have a future?

718


can we swap two different string using php for example:-- before swapping:-- 1 string :-hello friend, 2 string :-my dear, after swapping that strings will be: 1.hello dear, 2.my friend.

3298


Is python better than php?

720


What is strstr php?

721


Does php support inheritance?

690


Is php easy language to learn?

792


Is php a dying language?

727


What is the meaning of ‘escaping to php’?

823


How is it possible to return a value from a function?

751


Xplain is it possible to use com component in php?

703


What is meant by an associative array?

729


What is the maximum size of a table in mysql?

744


How do you pass a variable by value in php?

724