我需要一些帮助才能将视频文件上传到数据库中。
当我上传我的脚本成功但数据库中没有任何内容发生时,没有文件。
<html>
<head>
<title> upload </title>
<link rel='stylesheet' href='style.css' />
</head>
<body>
<?php
include 'connect.php';
?>
<div id='box'>
<form method='post' enctype='multipart/form-data'>
<?php
if (isset($_FILES['video'])) {
$name = $_FILES['video']['name'];
$type = explode('.', $name);
$type = end($type);
$size = $_FILES['video']['size'];
$random_name = rand();
$tmp = $_FILES['video']['tmp_name'];
if ($type != 'MOV' && $type != 'mov' && $type != 'QucikTime-film'){
$message = "Video Format Not Supported !";
} else {
move_uploaded_file($tmp, 'videos/'.$random_name.'.'.$type);
{
mysqli_query($connect,"INSERT into videos VALUES (''. '$name', 'videos/$random_name.$type')");
$message = "Successfully Uploaded ! ";
}
}
echo "$message <br/><br/>";
}
我在这里做错了吗?
我的connect.php应该全部设置
define("DB_SERVER", "localhost:3306");
define("DB_USER", "root");
define("DB_PASSWORD", "root");
define("DB_DATABASE", "video_system");
$connect = mysqli_connect(DB_SERVER , DB_USER, DB_PASSWORD, DB_DATABASE);
答案 0 :(得分:0)
在这里你可以得到你正在寻找的东西...... https://www.phptpoint.com/upload-video-in-php/
php中上传图片/视频/文件的基本内容首先是你必须写出存储它的路径..