use File::Basename; use HTTP::BrowserDetect; fileparse_set_fstype( do { my $browser = HTTP::BrowserDetect->new; return 'MSWin32' if $browser->windows; return 'MacOS' if $browser->mac; $^O; } ); my @file = basename($path, '\.[^\.]*');
This code makes use of HTTP::BrowserDetect to determine the browser and thus operating system which has submitted the multipart-encoded request. This is then used to set the file-system parsing routines of File::Basename appropriately - The basename method of this module is then used to strip the directory path and return the submitted file name.
In reply to Re: Extracting filename from a path string
by rob_au
in thread Extracting filename from a path string
by Snaps_Provolone
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |