<form action="" method="post" enctype="multipart/form-data">
<label for="file" class="tbl">Filename:</label>
<input type="file" name="vid" id="file"><br>
<input type="submit" name="submit" value="Submit">
</form>
To View from Database:
<?php
$select=mysql_query("select * from myblog where id='$id' ");
while($fetch1=mysql_fetch_array($select))
{
$video=$fetch1['video'];
?>
<video width="320" height="240" controls>
<source src="uploadvideo/<?php echo $video;?>" type="video/mp4">
<source src="video/<?php echo $video; ?>" type="video/ogg" />
</video>
<?php }?>
To insert in Database:
<?php
if(isset($_POST['submit']))
{
$id=$_POST['id'];
$video=$_FILES['vid']['name'];
$type=$_FILES['vid']['type'];
$size=$_FILES['vid']['size'];
$tempname=$_FILES['vid']['tmp_name'];
$dir="uploadvideo/".$video;
move_uploaded_file($tempname,"$dir");
$insert=mysql_query("insert into myblog(`video`) values ('$video')")or die(mysql_error());
if($insert)
{
echo "<script>alert('Inserted Succesful')</script>";
}
}
?>
Coding for Video:
<video width="320" height="240" controls>
<source src="nature5.MP4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
how did you set default values for type in db??
ReplyDeleteBest lojas in internet
ReplyDeleteits not working dude...
ReplyDeletegive the warrnig than how do u..
ReplyDelete?
can you give me idea about that how to define size of video and then upload it.
ReplyDeleteneed a good script
ReplyDelete