0

I am trying to let users upload .flv files that will be played through flow player. While I am not getting an error, the file is not copying to the ftp folder. The upload script I have is

if ($_FILES["file1"]["type"] == "video/flv")
  {
$path1 = "uploads/".time().'.'.$HTTP_POST_FILES['file1']['name'];
$path1 = str_replace (" ", "", $path1);
$path1 = str_replace("#", "No.", $path1); 
$path1 = str_replace("$", "Dollar", $path1); 
$path1 = str_replace("%", "Percent", $path1); 
$path1 = str_replace("^", "", $path1); 
$path1 = str_replace("&", "and", $path1); 
$path1 = str_replace("*", "", $path1); 
$path1 = str_replace("?", "", $path1); 

if ($_FILES["file1"]["error"] > 0)
  {
  header("location:video.php");
  die();
  }
else
  {
  copy($_FILES["file1"]["tmp_name"],$path1);
  }
  }
4
Contributors
7
Replies
8
Views
6 Years
Discussion Span
Last Post by cereal
0

Try to add video/x-flv to the conditional statement.

this seems to have done the trick, could you explain what the x- means?

0

Great! :) On linux there is the command file that gives you the correct mime-type for each file:

file --mime video.flv

the result is video.flv: video/x-flv; charset=binary

0

One more suggestion, instead of this many str_replaces, use arrays to replace the relevant chars.

0

One more suggestion, instead of this many str_replaces, use arrays to replace the relevant chars.

how might that be done?

0

This way:

$a = array(' ','#','$','%','^','&','*','?');
$b = array('','No.','Dollar','Percent','','and','','');
$path1 = str_replace($a,$b,$path1);
This question has already been answered. 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.