Page 1 of 1
cant upload with internet explorer
Posted: Mon Jul 02, 2007 11:48 pm
by pleigh
hi, i have this code
Code: Select all
if (!($_FILES['uploaded']['type'] == "application/zip")) {
echo "<font color='red'>You may only upload ZIP files.</font><br>";
}
in firefox, its running ok, but in internet exporer it doesn't. maybe you can help me with this. by the way, the upload will only honor .zip file extension.
thank you in advance
Posted: Mon Jul 02, 2007 11:51 pm
by Benjamin
Posted: Tue Jul 03, 2007 12:03 am
by pleigh
firefox, i got this --> application/zip
ie, i got nothing.
Posted: Tue Jul 03, 2007 12:13 am
by Benjamin
IE is not providing a mime type. You'll need to verify it is a zip server side.
Posted: Tue Jul 03, 2007 12:27 am
by feyd
Never assume what is in the "type" field of uploads as fact, as this has evidenced. You need to check the file's type yourself, always, unless you know exactly what you're doing.
Posted: Tue Jul 03, 2007 5:06 am
by pleigh
could you show me an example on how to fix this??i really dont know.

Posted: Tue Jul 03, 2007 5:43 am
by miro_igov
remove if (!($_FILES['uploaded']['type'] == "application/zip")) block and
Code: Select all
$za = new ZipArchive();
if(! $za->open($_FILES['uploaded']['tmp_name']))
echo "<font color='red'>You may only upload ZIP files.</font><br>";
}