我的这段代码是在数据库中上传视频和相同的内容。我只收到一条通知是“未定义的索引:视频”
注意:未定义的索引:第5行的C:\ wamp \ www \ SSP Final project \ php \ upload.php中的视频
注意:未定义的索引:第13行的C:\ wamp \ www \ SSP Final project \ php \ upload.php中的视频
注意:未定义的索引:第14行的C:\ wamp \ www \ SSP Final project \ php \ upload.php中的文本
注意:未定义的索引:第20行的C:\ wamp \ www \ SSP Final project \ php \ upload.php中的视频
听到的是表格
<form method="POST" action="../../php/upload.php" enctype='multipart/form-data'>
<table class="booking_table" cellpadding="40" style="margin:auto;margin-top:10px;">
<tr>
<td>
<input type="hidden" name="size" value="90000000000">
<input type="file" name="video">
</td>
</tr>
<tr>
<td>
<textarea name="text" cols="40" rows="4" placeholder="Say something about Yout band......"></textarea>
</td>
</tr>
<tr>
<td>
<input type="submit" name="upload" value="Upload ">
</td>
</tr>
</table>
</form>
听到的是php
var_dump($_FILES);
//the parth to store the upload video
$target= "../videos/".basename($_FILES['video']['name']);
//conect to database
$db = mysqli_connect('localhost', 'root', '', 'sspfinal');
//get all the submited data from the form
$image = $_FILES['video']['name'];
$txt = $_POST['text'];
$sql="INSERT INTO band(video,text) values ('$image','$txt')";
mysqli_query($db,$sql);//store the submited data into the database table : bands
//move the upload image to the folder
if(move_uploaded_file($_FILES['video']['name'].$target)){
$msg="Image Uploaded Successfully";
}
else{
$msg="There was a problem to upload";
}
帮我找到这个错误
答案 0 :(得分:0)
您忘记在表单标记中使用enctype='multipart/form-data'
来发送文件。