00439: Bad recognition of filetype if $UploadDir contains a .

Summary: Bad recognition of filetype if $UploadDir contains a .
Created: 2005-05-12 07:25
Status: Closed -- fixed for 2.0.beta41
Category: Bug
From: Zoyo?
Assigned:
Priority: 5
Version: 2.0.beta35
OS: Linux/Apache/4.3.10

Description: Hi,

I set $UploadDir="/htdocs/www.gargelpu.com/www/pmwiki/files" and when I try to upload a file foo without extension I got the error message that the filetype "com/www/pmwiki/files/foo" is not allowed.

So I propose to change Line 197 of scripts/upload.php (function UploadVerifyBasic()) from

preg_match('/\\.([^.]+)$/',$filepath,$match);$ext=@$match[1];

to

preg_match('#\\.([^./]+)$#',$filepath,$match); $ext=@$match[1];

It seems to work. Or you can use basename($filepath) in the first version which may be better to understand.

regards,
Zoyo


Excellent bug report and proposed fix -- many thanks!

Pm