
razman
Novice
Jun 14, 2009, 9:49 AM
Post #1 of 8
(3051 views)
|
|
fileparse and $query->param('Image_Upload')
|
Can't Post
|
|
Question One: I posted this on the beginners forum but received no results. Because of that, I thought I would repost with the experts. The author of a file upload script (KevinR) has the following comments and code within the script. # get the filename and the file extension # this could be used to filter out unwanted filetypes # see the File::Basename documentation for details my ($filename,undef,$ext) = fileparse($file,qr{\..*}); This page tells me what fileparse is doing: http://perldoc.perl.org/File/Basename.html Am I correct to understand that ultimately $ext contains the file extension. Now what? How do I only allow .jpg uploads? Thanks for pointing me in the right direction. Question Two: I am using an HTML form with <input type=file name="Image_Upload">. Yes, the action statement includes ...METHOD="post" ENCTYPE="multipart/form-data"> Within the Perl script, I am using $Image_Upload=$query->param('Image_Upload'); My script works with Internet Explorer 7, but not with Firefox or Opera. I am guessing that the information contained in "Image_Upload" is determined by the browser's internal coding, and I also imagine that coding follows (or should) some RFC somewhere. It is apparent that IE, Firefox, and Opera are each bringing something different to the "Image_Upload" table. How do I sort this out? Thanks, Rich
|