Page 1 of 1

Upload Problem II

Posted: Sun Jun 27, 2004 2:06 pm
by Joe
I am having a bit of a problem with my upload code. Everytime I try to upload a file all I get is an error. What I am trying to create is an array with the file extensions which are allowed to be passed to the server. The code works great when I take this array out so I know it has something to do with it. The code for my array go's like:

$array = array("application/vnd.ms-excel", "application/msword", "application/zip", "application/rtf");

if (!in_array($_FILES['imagefile']['type'], $array))
{
echo "An unexpected error has occured. Please view the <A href='help.php'>help file</A> for more information!";
exit;
}

I tried uploading .zip and .rtf with no luck. Any help appreciated!


Joe 8)

Posted: Sun Jun 27, 2004 2:34 pm
by feyd
maybe your browser is sending a different type, or not one at all... what does echoing $_FILES['imagefile']['type'] say?

Posted: Mon Jun 28, 2004 6:26 am
by Grim...
I'm pretty sure everything is a tmp file when it is uploaded.
Have you considered doing a substr for the last three letters of the file name after it has been uploaded?

Posted: Mon Jun 28, 2004 6:29 am
by patrikG
what does

Code: Select all

var_dump($_FILES['imagefile']['type']);
print?