表单提交不适用于视频

时间:2014-06-29 06:32:05

标签: php html file upload

因此我花了很多时间编写这个脚本来上传文件,在我用一些图片完成所有测试后,我尝试使用从Youtube(11mb)下载的小型MP4视频并且它不起作用。这是我的表格:

<form role="form" action="php/functions/uploadVideo.php" method="POST"
                      onsubmit="return checkFile(200097152)" enctype="multipart/form-data"">
                    <div class="form-group">
                        <label for="videoTitle">Title</label>
                        <input type="text" class="form-control" name="videoTitle" placeholder="Enter a title..." required>
                    </div>
                    <div class="form-group">
                        <label for="description">Description</label>
                        <textarea class="form-control" name="videoDescription" rows="5" required></textarea>
                    </div>
                    <div class="form-group">
                        <label for="videoTags">Tags</label>
                        <input type="text" class="form-control" name="videoTags" placeholder="Separate tags with a commma..." required>
                    </div>
                    <div class="form-group">
                        <label for="exampleInputFile">File input</label>
                        <input type="file" name="videoFile" id="videoFile" required>
                    </div>
                    <center><button id="upload-video-btn" type="submit" class="btn btn-default">Upload</button></center>
                    <input type="hidden" name="user" value="<?php echo $_SESSION['username']; ?>">
                </form>

这是我的剧本:

$artistName  = mysql_real_escape_string($_POST['user']);
$title       = mysql_real_escape_string($_POST['videoTitle']);
$description = mysql_real_escape_string($_POST['videoDescription']);
$tags        = mysql_real_escape_string($_POST['videoTags']);

$uploadsDir  = $_SERVER['DOCUMENT_ROOT']."bcm/videos/";
$tmpName     = $_FILES["videoFile"]["tmp_name"];
$name        = $_FILES["videoFile"]["name"];

move_uploaded_file($tmpName, "$uploadsDir$name");

结果是所有变量都有未定义的索引,正如我所说,它与图像完美配合,但与视频无关。

0 个答案:

没有答案