Marais has asked for the wisdom of the Perl Monks concerning the following question:
HTML page:
<DOCTYPE html> <HTML> <BODY> <form action="filename_entity_test.cgi" method="post" enctype="multipa +rt/form-data"> Test file name: <input type="file" name="fn"> <br> <input type="submit" name="submit" value="Upload"> </form> </BODY> </HTML>
CGI code:
#!/usr/bin/perl -w use strict; use CGI qw(:cgi-lib); use CGI::Carp qw(warningsToBrowser fatalsToBrowser); use HTML::Entities; my ($cg, $filename); $cg = new CGI; print $cg->header; print $cg->start_html("Testing decode_entities"); $filename = $cg->param("fn"); print "Filename before call to decode_entities: $filename<br>\n"; decode_entities($filename); print "Filename after call to decode_entities: $filename<br>\n"; print $cg->end_html;
Calling decode_entities with other cgi parameters is successful, and calling it like this:
is also successful.$filename = decode_entities($filename);
In retrospect, I don't really need to worry about entities in the filename, but I'm very curious as to what is going on here.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI Filenames and decode_entities
by roboticus (Chancellor) on Jul 23, 2015 at 16:53 UTC | |
by kennethk (Abbot) on Jul 23, 2015 at 21:54 UTC | |
by Marais (Novice) on Jul 23, 2015 at 21:54 UTC | |
|
Re: CGI Filenames and decode_entities (why)
by Anonymous Monk on Jul 23, 2015 at 22:42 UTC | |
by Marais (Novice) on Jul 23, 2015 at 22:56 UTC | |
by Anonymous Monk on Jul 24, 2015 at 00:08 UTC |