in reply to Getting a file's extension in an upload form
I've come up with a dirty yet fast solution to this problem. This should get the file's extension (considering whatever is after the last period) and also get rid of any junk that Windows NT appends to the filename when it's being pulled from the Desktop.
@extension = split(/\./,$filename); $extension = $extension[$#extension]; @extension = split(/\\/,$extension); $extension = $extension[0];
So if $filename is something like "C:\Whatever\some horrible.filename.by.me.doc\\NTDesktop\whatever", this will return "doc".
- Ralph
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Getting a file's extension in an upload form
by periapt (Hermit) on Jun 18, 2004 at 13:56 UTC |