adspace


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 current stable version of php?

1121


Tell me what kind of things have you done on the social side?

1063


Name and explain five of the PHP error constants?

1032


sort term descripttion form, report and uery

2254


What is trait in php?

1065


What is the difference between htmlentities() and htmlspecialchars()?

1089


Write a program using while loop?

1115


if you run the app program all vendor open items are cleared but is it possible to reverse the again again open items please tell me the answer

1987


What is the current stable version of php? What advance thing in php7?

1093


Explain me is it possible to destroy a cookie?

1025


What sized websites have you worked on in the past?

1084


how to detect a mobile device using php

1172


How to create a web form?

1108


How to calculate the difference between two dates using php?

1142


What is difference between static and final in php?

1107