dare87 Posted December 9, 2008 Share Posted December 9, 2008 I'm trying to upload a mov file using the following form, but all the page seems to do is refresh. Any ideas? Thanks <?php if (isset($_POST['submit-upload'])) { // LET'S DO A LITTLE VALIDATION FOR THE FILE // THESE VARS ARE THE TEMP AND ORIGINAL NAME OF THE FILE $fileTemp = $_FILES['uploadedfile']['tmp_name']; $fileName = $_FILES['uploadedfile']['name']; // THIS ONE IS FOR THE TYPE OF FILE UPLOADED $fileType = $_FILES['uploadedfile']['type']; // IF THE TYPE ISN'T AUDIO/MPEG THEN... if ($fileType != "video/mov") { print("The file you tried to upload seems to be an .mp3 please try again."); } // RENAME THE FILE USING A TIME STAMP SO IT WILL NEVER BE THE SAME AND APPEND A RANDOM NUMBER $randomNumber = rand(1, 999999); $newFileName = time() . $randomNumber . ".mov3"; // Where the file is going to be placed $target_path = "video/$newFileName"; // IF THE COMMENT FIELD ISN'T EMPTY RECORD IT if (!empty($_POST['comment'])) { $comment = $_POST['comment']; } if (!empty($_POST['intext'])) { $intext = $_POST['intext']; } if(move_uploaded_file($fileTemp, $target_path)) { // REQUIRE THE DATABASE CONNECTION require_once('mysql_connect.php'); // INSERT THE DATA INTO MYSQL $query = "INSERT INTO video SET name='$fileName', comment='$comment', intext='$intext', newname='$newFileName'"; $results = @mysql_query($query); echo "The file <b>$fileName</b> has been uploaded<br>It was posted in the "; if ($intext=2) { echo "Private section<br><br>"; } else { echo "Public section<br><br>"; } } else { echo "There was an error uploading the file."; } } else { ?> <form enctype="multipart/form-data" action="video_upload.php" method="POST"> <table align="center" width="100%" border="0" cellpadding="1" cellspacing="0"> <tr> <td colspan="2"><b>Add Music</b></td> </tr> <tr> <td>File:</td> <td><!--<input type="hidden" name="MAX_FILE_SIZE" value="20000000" />--><input name="uploadedfile" class="required" type="file" /></td> </tr> <tr> <td>Display Name:</td> <td><input type="text" class="required" name="comment" id="focus" size="40" value="<?php echo $comment; ?>" maxlength="40"></td> </tr> <tr> <td>Public/Private:</td> <td><select class="required" name="intext"> <option value="">SELECT</option> <option value="2">Private</option> <option value="1">Public</option> </select></td> </tr> <tr> <td> </td> <td><input type="submit" class="button" name="submit-upload" value="Upload File" /></td> </tr> <tr> <td> </td> <td class="smallText">* Highlighted forms designate required fields.</td> </tr> </table> </form> <?php } ?> Link to comment https://forums.phpfreaks.com/topic/136242-upload-mov/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.