0

I wish to limit uploading to the video files swf pps bmp pps png gif mpg mp3 and wav - i'm sure I have the file / type incorrect. can someone please give logical solution...

here's my code:

<?php
if ((($_FILES["file"]["type"] == "video/swf")
|| ($_FILES["file"]["type"] == "video/pps")
|| ($_FILES["file"]["type"] == "video/bmp")
|| ($_FILES["file"]["type"] == "video/pps")
|| ($_FILES["file"]["type"] == "video/png")
|| ($_FILES["file"]["type"] == "video/gif")
|| ($_FILES["file"]["type"] == "video/mp3")
|| ($_FILES["file"]["type"] == "video/wav"))
&& ($_FILES["file"]["size"] < 200000))
  {
  if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
    }
  else
    {
    echo "Upload: " . $_FILES["file"]["name"] . "<br />";
    echo "Type: " . $_FILES["file"]["type"] . "<br />";
    echo "Size: " . ($_FILES["file"]["size"] / 200000) . " Kb<br />";
    echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";

    if (file_exists("upload/" . $_FILES["file"]["name"]))
      {
      echo $_FILES["file"]["name"] . " already exists. ";
      }
    else
      {
      move_uploaded_file($_FILES["file"]["tmp_name"],
      "upload/" . $_FILES["file"]["name"]);
      echo "Thank you for your" . "upload/" . $_FILES["file"]["name"];
      }
    }
  }
else
  {
  echo "Invalid file";
  }
?>

Edited by peter_budo: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)

3
Contributors
2
Replies
4
Views
8 Years
Discussion Span
Last Post by crohole
0

I wish to limit uploading to the video files swf pps bmp pps png gif mpg mp3 and wav>

Not all of those are video files. (Or rather; the extensions of known video formats.)
Only SWF and MPG would qualify. Unless you also count animated images, in which case PNG and GIF would count as well.

But yea, you have the mime types wrong.
You can look up the proper mime types at w3schools.com.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.