PHP:数据库中的视频插入

时间:2014-04-15 05:02:52

标签: javascript php mysql

这是我的表格。它正在努力将文件插入数据库我需要检索并在我的系统上播放该视频..任何人都可以给我更多的代码吗? 如何使用和/或如何将视频播放器添加到我的代码

<?php 
include "config.php";
$videoname = $_REQUEST["vname"];
$category = $_REQUEST["cat"];
$keyword = $_REQUEST["kwd"];
$target = "C:/xampp/htdocs/upload/"; 
$target = $target . basename( $_FILES['uploaded']['name']) ; 
$ok=1; 

if ($_FILES["uploaded"]["error"] > 0)
{
    echo "Apologies, an error has occurred.";
    echo "Error Code: " . $_FILES["uploaded"]["error"];
}
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) 
{
    echo "The file ". basename( $_FILES['uploaded']['name']). " has been uploaded";
} 
else 
{
    echo "Sorry, there was a problem uploading your file.";
}
?>
<?php
$path = str_replace("C:/xampp/htdocs","http://localhost",$target);
$query = "INSERT INTO videos(videoname, category, keywords, path)";
$query .= "VALUE ('$videoname', '$category', '$keyword', '$path')";
$result = mysql_query($query);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"                    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
</head>
<body>
<form enctype="multipart/form-data" action="upload_file.php" method="POST">
    Video Name :<input type="text" name="vname"/><br/>
    Category : <input type="text" name="cat"/><br/>
    Keywords : <input type="text" name="kwd"/><br/>
    Please choose a file: <input name="uploaded" type="file" /><br />
    <input type="submit" value="Upload" />
</form> 
</body>
</html>

0 个答案:

没有答案