Jump to content

[SOLVED] Video Upload error


pcw

Recommended Posts

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

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.