0

so I spend quite a lot of time writing this script for uploading files and after I've done all the tests with some pictures I tried it with a small MP4 video I downloaded from Youtube (11mb) and it doesn't work. This is my form:

<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>

and this is my script:

$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");

The result is undefined index on all the variables, as I said it works perfect with images but not with videos.

user43051
  • 345
  • 2
  • 5
  • 17

0 Answers0