Mozilla and postdata...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Czar
Forum Commoner
Posts: 58
Joined: Sun Dec 29, 2002 11:17 am

Mozilla and postdata...

Post 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?
rehfeld
Forum Regular
Posts: 741
Joined: Mon Oct 18, 2004 8:14 pm

Post by rehfeld »

echo $_FILES['userfile']['type']

to see what type it is actually sending
Post Reply