pcw Posted April 12, 2009 Share Posted April 12, 2009 Hi, I am trying to integrate video uploads into my site, but it keeps saying it is a invalid file. I am not sure what I am doing wrong <?php include("templates/common/header.php"); include("data/definitions.php"); if (($_FILES["file"]["type"] == "video/mpeg") && ($_FILES["file"]["size"] < 200000)) { $UploadDir = "../../members/uploads/"; $filename = $_FILES["file"]["name"]; echo "<center></br>"; echo "<p class=style3><b>Upload: " . "$filename </b></p><br />"; if (file_exists($UploadDir . $_FILES["file"]["name"])) { echo "<p class=style3><b>$filename" . " already exists.</b></p> "; echo "</center>"; } else { move_uploaded_file($_FILES["file"]["tmp_name"], $UploadDir . $_FILES["file"]["name"]); $image = ($UploadDir . $_FILES["file"]["name"]); echo '<embed autostart="true" bgcolor="FF6600" border="20" hidden="false" loop="true" controller="false" src="$image">'; } } else { echo "<p class=style3>Invalid File</p>"; } ?> Any help is much appreciated Thanks Link to comment https://forums.phpfreaks.com/topic/153734-solved-video-upload-error/ Share on other sites More sharing options...
ToonMariner Posted April 12, 2009 Share Posted April 12, 2009 check that if (($_FILES["file"]["type"] == "video/mpeg") && ($_FILES["file"]["size"] < 200000)) evaluates to true before that statement put echo 'file type = '. $_FILES["file"]["type"] . ' Filesize = ' .$_FILES["file"]["size"]; that will be the 1st step in solving your problem. Link to comment https://forums.phpfreaks.com/topic/153734-solved-video-upload-error/#findComment-807887 Share on other sites More sharing options...
PFMaBiSmAd Posted April 12, 2009 Share Posted April 12, 2009 For debugging, display exactly what you are getting from the form, because it is likely you are getting an upload error due to the size of the file - echo "<pre>"; echo "POST:"; print_r($_POST); echo "FILES:"; print_r($_FILES); echo "</pre>"; And someone went to the trouble in one of your other threads to list what your upload code should be doing to get it to tell you why it is failing - http://www.phpfreaks.com/forums/index.php/topic,247197.msg1156255.html#msg1156255 If you don't bother to use the information you have been given, you are doomed to repeat bad coding that does not work and does not tell you why it is not working. Link to comment https://forums.phpfreaks.com/topic/153734-solved-video-upload-error/#findComment-807895 Share on other sites More sharing options...
pcw Posted April 12, 2009 Author Share Posted April 12, 2009 Thanks ToonMariner, I simply missed a 0 off of the file size PFMaBiSmAd - I didnt understand how to implement what they were suggesting. Its not that I havent bothered to use it, its just I dont know how. Link to comment https://forums.phpfreaks.com/topic/153734-solved-video-upload-error/#findComment-807902 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.