Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: checking file types in a perl upload script

by rob_au (Abbot)
on Feb 16, 2002 at 08:28 UTC ( [id://145826]=note: print w/replies, xml ) Need Help??


in reply to checking file types in a perl upload script

A simple search of this site would have revealed a number of nodes relating to CGI-based file upload, including one from myself here. This question could also have been answered by having a read through some of the documentation for CGI, specifically under the heading "Creating a file upload field".

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'

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://145826]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-04-18 00:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found