in reply to checking file types in a perl upload script
However, it should be noted, that you should not necessarily trust the extension of the file name supplied with the binary stream. As such, depending upon the intended application of the uploaded files, it would be wise to make use of a module such as File::MMagic (or the shell command file if installed), which allows for the identification of file types based upon file names and file content - This allows files to be verified that the file content type matches the name given.
perl -e 's&&rob@cowsnet.com.au&&&split/[@.]/&&s&.com.&_&&&print'
|
|---|