in reply to getstore problem
You are using a relative directory path, and your current directory is not what you think. Use the full path to your "temp" directory, or better, use the File::Temp module to create a filename for a temporary file:
#!/usr/bin/perl -wT use strict; BEGIN { $|=1; print "Content-type: text/html\n\n"; use CGI::Carp('fatalsToBrowser'); } use CGI; use LWP::Simple; use File::Temp qw(tempfile); use CGI::Untaint; my $handler = CGI::Untaint->new($q->Vars); my ($fh,$name) = tempfile( "fileXXXXXXXX.jpg", DIR => '/home/web/user1 +/temp' ); my $url = $handler->extract(-as_url => 'set'); #my $url = $q->param('set'); #$url =~ m!^(http://[-.\w?&;]+.jpg)! # or die "The url does not look valid"; #$url = $1; getstore($url,"../temp/$filename");
Please note that your script as written can be used to attack other webservers. You will want to restrict your script so it cannot be used by other people.
Update: Changed the code to use CGI::Untaint::url, which I trust more than my half-baked, restricted attempt
|
|---|