Lessur
02-17-2006, 12:59 AM
Ok, I have a Medi Submission Portal, where I want users to be able to submit .swf's and .wmv's.
I am having trouble just letting them upload .swf'd and .wmv's.
I have this code:
$types=array(".swf",".wav");
$title=addslashes(strip_tags($_POST['title']));
$desc=addslashes(strip_tags($_POST['desc']));
$wide=addslashes(strip_tags($_POST['wide']));
$high=addslashes(strip_tags($_POST['high']));
$cat=addslashes(strip_tags($_POST['catergory']));
$tac=addslashes(strip_tags($_POST['terms_and_conditions']));
$max_filesize = 5000000;
$filename=rand(500,2000).$_FILES['file']['name'];
if ($title == ""){
echo "Field title left blank <a href='?'>Go back?</a>";
}
elseif($desc == ""){
echo "Field desccription left blank <a href='?'>Go back?</a>";
}
elseif ($wide == ""){
echo "Field width left blank <a href='?'>Go back?</a>";
}
elseif ($high == ""){
echo "Field height left blank <a href='?'>Go back?</a>";
}
elseif ($cat == ""){
echo "Field catergory left blank <a href='?'>Go back?</a>";
}
elseif ($tac == ""){
echo "You must agree to the terms and conditions! <a href='?'>Go back?</a>";
}
elseif (!is_numeric($wide) || !is_numeric($high)){
echo "Field width or height false <a href='?'>Go back?</a>";
}
elseif ($_FILES['file']['name'] == "") {
echo "Field flash file left blank <a href='?'>Go back?</a>";
}
elseif ($_FILES['file']['size'] > $max_filesize){
echo "Error! flash file must not be bigger than 5 MB <a href='?'>Go back?</a>";
}
elseif (!strpos($_FILE['file']['type'], $types,-4)){
echo "File type not accepted";
}]
And so on, that is all that should be needed here.
This code, unfortunatly, wont let any files through.
What is the problem here?
I am having trouble just letting them upload .swf'd and .wmv's.
I have this code:
$types=array(".swf",".wav");
$title=addslashes(strip_tags($_POST['title']));
$desc=addslashes(strip_tags($_POST['desc']));
$wide=addslashes(strip_tags($_POST['wide']));
$high=addslashes(strip_tags($_POST['high']));
$cat=addslashes(strip_tags($_POST['catergory']));
$tac=addslashes(strip_tags($_POST['terms_and_conditions']));
$max_filesize = 5000000;
$filename=rand(500,2000).$_FILES['file']['name'];
if ($title == ""){
echo "Field title left blank <a href='?'>Go back?</a>";
}
elseif($desc == ""){
echo "Field desccription left blank <a href='?'>Go back?</a>";
}
elseif ($wide == ""){
echo "Field width left blank <a href='?'>Go back?</a>";
}
elseif ($high == ""){
echo "Field height left blank <a href='?'>Go back?</a>";
}
elseif ($cat == ""){
echo "Field catergory left blank <a href='?'>Go back?</a>";
}
elseif ($tac == ""){
echo "You must agree to the terms and conditions! <a href='?'>Go back?</a>";
}
elseif (!is_numeric($wide) || !is_numeric($high)){
echo "Field width or height false <a href='?'>Go back?</a>";
}
elseif ($_FILES['file']['name'] == "") {
echo "Field flash file left blank <a href='?'>Go back?</a>";
}
elseif ($_FILES['file']['size'] > $max_filesize){
echo "Error! flash file must not be bigger than 5 MB <a href='?'>Go back?</a>";
}
elseif (!strpos($_FILE['file']['type'], $types,-4)){
echo "File type not accepted";
}]
And so on, that is all that should be needed here.
This code, unfortunatly, wont let any files through.
What is the problem here?