Hi Again
The uploaded code here works and if you notice I have editted out the video type section. If the video type is not editted out it does not work
saying the video type not accepted even when the video type is correct.
$title=addslashes(strip_tags($_POST['title']));
$desc=addslashes(strip_tags($_POST['desc']));
$tags=addslashes(strip_tags($_POST['tags']));
$filename = basename($_FILES['filename']['name']);
$type=$_FILES["filename"]["type"];
$size=$_FILES["filename"]["size"];
$temp_name=$_FILES["filename"]["tmp_name"];
$error=$_FILES["filename"]["error"];
if($title&&$filename&&$desc&&$tags)
{
/*
if (($type == "video/flv")
|| ($type == "video/avi")
|| ($type == "video/mov")
|| ($type == "video/wmv"))
{ */
if ($_FILES["filename"]["error"] > 0)
{
echo "Error: " . $_FILES["filename"]["error"] . "<br />";
}
else
{
if($_FILE["filename"]["size"]<74295516)
{
echo "Uploading please wait.";
}
else
{
echo "<font color='#8B2323' size='3' face='Times New Roman, Times, serif'>Only less than five minute videos allowed.</font>";
}
}
/*}
else
{
echo "<font color='#8B2323' size='3' face='Times New Roman, Times, serif'>Upload must be an video wmv, mov, avi or flv.</font>";
} */
}
else
{
echo "<font color='#8B2323' size='3' face='Times New Roman, Times, serif'>Fill in all fields and make sure you have selected video.</font>";
}
Tony404 wrote: The uploaded code here works and if you notice I have editted out the video type section. If the video type is not editted out it does not worksaying the video type not accepted even when the video type is correct. |
I've not read every single word of this thread, so forgive me if this is something that has already been covered. Have you tried using echo to see what $type contains?
I'm pretty certain that PHP doesn't test the MIME type itself. It just accepts the value submitted by the browser. In the case of JPEG files, Internet Explorer uses image/pjpeg instead of the standard image/jpeg. It's possible that the MIME type is being submitted in a different format from those that you're testing for. You might also find it more convenient to create an array of MIME types and use in_array() rather than a series of comparison operators. For example:
$mimetypes = array('video/mov', 'video/flv', 'video/avi');
if (in_array($type, $mimetypes)) {
// it's OK
}