PDA

View Full Version : Uploading file types


Temper
06-22-2003, 03:40 AM
I've made an upload script for my site, but I can't figure out how to limit the file types. I want to be able to upload .w3g files onto my site, but I don't know how to set it up.
This is what I have:

if ($HTTP_POST_FILES['file']['extention'] != ".w3g" AND $HTTP_POST_FILES['file']['extention'] != ".w3g") {
echo "This file type is not allowed";
} else {
(upload script)

Thanks in advance.
~Mike

firepages
06-22-2003, 04:37 AM
there is no such variable as ..$HTTP_POST_FILES['file']['extention'] , there is $_FILES['userfile']['mime'] but that won't help here

but you could do this (or similar)..


<?
if(substr($_FILES['userfile']['name'],-3)!='w3g'){
//cool
}else{
//uncool
}
?>

Temper
06-22-2003, 06:17 PM
Thanks so much, it works perfectly!