PDA

View Full Version : Help, file upload extension control not working - SOLVED array was incorrect


Vaupell
02-27-2010, 02:45 PM
Working on a request, should have been real simple but alot problems
just keep comeing up.

Anyway uploading images via a form, etc
I only want to check .extentions

and was working on this a few days ago, and it was working, but now not so much
anymore..

emap_extensions = jpg,png,gif
file = file selected in gui by user.


$extensions = explode(',', $vbulletin->options['emap_extensions']);
$filename = $_FILES["file"]["name"];
$fileext = substr($filename, strpos($filename, '.'), strlen($filename)-1);

if (!in_array($fileext,$extensions))
{
// here i do stuff.


Anyway the problem is, it allows ANY files to be uploaded
which kinda ruins the idea of setting a limit..

I have tryed many many many different control approaches
and arent really happy with any of them.

Any help would be appriciated.

Vaupell
03-01-2010, 11:51 AM
solved, the problem was my array with allowed file types..

extensions was mising the DOT ....... infront of extension.