Page 1 of 1

Mozilla and postdata...

Posted: Thu Dec 09, 2004 2:00 pm
by Czar
I have follwing part in my upload script, that determines allowed file extensions and max. file size.

Code: Select all

<?php
$allowed_types = array( 
        "image/gif" => "gif", 
        "image/pjpeg" => "jpg", 
    ); 
    if(!array_key_exists($_FILES['userfile']['type'], $allowed_types)) { 
        die("<b>Invalid file type.</b>"); 
    } 
    $maxfilesize = 307200; 
    if($_FILES['userfile']['size'] > $maxfilesize) { 
        die("File too large"); 
    } 
?>
In mozilla (firefox) it always throws an error "Invalid file type" as defined above, but with IE upload is ok. Why cant i upload with firefox? Smthn different in mozilla's headers?

Posted: Thu Dec 09, 2004 2:31 pm
by rehfeld
echo $_FILES['userfile']['type']

to see what type it is actually sending