php form upload video files not working

Reply

Join Date: Oct 2009
Posts: 1
Reputation: fudgealtoid is an unknown quantity at this point 
Solved Threads: 0
fudgealtoid fudgealtoid is offline Offline
Newbie Poster

php form upload video files not working

 
0
  #1
Oct 16th, 2009
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:

  1. <?php
  2. if ((($_FILES["file"]["type"] == "video/swf")
  3. || ($_FILES["file"]["type"] == "video/pps")
  4. || ($_FILES["file"]["type"] == "video/bmp")
  5. || ($_FILES["file"]["type"] == "video/pps")
  6. || ($_FILES["file"]["type"] == "video/png")
  7. || ($_FILES["file"]["type"] == "video/gif")
  8. || ($_FILES["file"]["type"] == "video/mp3")
  9. || ($_FILES["file"]["type"] == "video/wav"))
  10. && ($_FILES["file"]["size"] < 200000))
  11. {
  12. if ($_FILES["file"]["error"] > 0)
  13. {
  14. echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
  15. }
  16. else
  17. {
  18. echo "Upload: " . $_FILES["file"]["name"] . "<br />";
  19. echo "Type: " . $_FILES["file"]["type"] . "<br />";
  20. echo "Size: " . ($_FILES["file"]["size"] / 200000) . " Kb<br />";
  21. echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";
  22.  
  23. if (file_exists("upload/" . $_FILES["file"]["name"]))
  24. {
  25. echo $_FILES["file"]["name"] . " already exists. ";
  26. }
  27. else
  28. {
  29. move_uploaded_file($_FILES["file"]["tmp_name"],
  30. "upload/" . $_FILES["file"]["name"]);
  31. echo "Thank you for your" . "upload/" . $_FILES["file"]["name"];
  32. }
  33. }
  34. }
  35. else
  36. {
  37. echo "Invalid file";
  38. }
  39. ?>
Last edited by peter_budo; Oct 17th, 2009 at 2:20 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 443
Reputation: Atli is on a distinguished road 
Solved Threads: 56
Atli's Avatar
Atli Atli is offline Offline
Posting Pro in Training
 
0
  #2
Oct 16th, 2009
Originally Posted by fudgealtoid View Post
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.
Please do not ask for help in a PM. Use the forums.
And use [code] tags!
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 28
Reputation: crohole is an unknown quantity at this point 
Solved Threads: 0
crohole crohole is offline Offline
Light Poster
 
0
  #3
Oct 17th, 2009
Maybe the trouble in php.ini maxfileupload.
Reply With Quote Quick reply to this message  
Reply

Tags
files, form, php, upload, video, website

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC