isync has asked for the wisdom of the Perl Monks concerning the following question:
which is served as "Content-Encoding: utf8;"<FORM ENCTYPE="multipart/form-data" ACTION="/cgi-bin/upload.pl" METHOD +="POST"> Please choose directory to upload to:<br> <SELECT NAME="dir" +> <OPTION VALUE="images">images</OPTION> <OPTION VALUE="sounds">sound +s</OPTION> </SELECT> <p> Please select a file to upload: <BR> <INPUT +TYPE="FILE" NAME="file"> <p> <INPUT TYPE="submit"> </FORM>
#!/usr/bin/perl -CS use CGI::Carp qw(fatalsToBrowser); use CGI; my $cgi = new CGI; my $file = $cgi->param('file'); $file=~m/^.*(\\|\/)(.*)/; # strip the remote path and keep the filenam +e my $name = $2; open(LOCAL, ">/var/www/mypath/$file") or die "$!: path: /var/www/mypat +h/$name file: $file"; while(<$file>) { print LOCAL $_; } print $cgi->header(); print "$file has been successfully uploaded... thank you.\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI.pm: "Malformed UTF-8 character" in apache's error.log
by Joost (Canon) on Feb 26, 2008 at 17:58 UTC | |
by isync (Hermit) on Feb 26, 2008 at 18:54 UTC | |
by ikegami (Patriarch) on Feb 26, 2008 at 19:17 UTC | |
|
Re: CGI.pm: "Malformed UTF-8 character" in apache's error.log
by Juerd (Abbot) on Feb 26, 2008 at 20:58 UTC | |
|
Re: CGI.pm: "Malformed UTF-8 character" in apache's error.log
by ikegami (Patriarch) on Feb 26, 2008 at 18:14 UTC | |
|
Re: CGI.pm: "Malformed UTF-8 character" in apache's error.log
by isync (Hermit) on Feb 26, 2008 at 19:26 UTC |