[ic] s/Reg Exps on file paths/headaches/g ;

Jason Kohles email@jasonkohles.com
Tue, 13 Mar 2001 09:50:25 -0500


On Tue, Mar 13, 2001 at 09:44:41AM -0500, office.standardprinting.net wrote:
> I'm working on an upload page, and found the docs on using [value-extended],
> etc.  So far, so good.
> 
> But the <input type="file" . . . > tag returns a full path from Win clients,
> e.g.: F:\folder\file.jpg (Macs dutifully return only the filename, not the
> whole path :)
> 
> $filename =~ s|.*[\\]{1}|| ;
> 
All you really need here is:

$filename =~ s|.*\\||;

to get rid of everything up to and including the last backslash.  You might
want to include forward slashes as well, as most unix browsers also return
the full path.  This should do the trick:

$filename =~ s|.*[\\/]||;

-- 
Jason S Kohles
jason@jasonkohles.com