Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Uploading a file

by SFLEX (Chaplain)
on Jan 10, 2007 at 14:30 UTC ( [id://593907]=note: print w/replies, xml ) Need Help??


in reply to Uploading a file

I posted the answer here problem in ciode.

Good Luck

Replies are listed 'Best First'.
Re^2: Uploading a file
by SFLEX (Chaplain) on Jan 10, 2007 at 14:39 UTC
    to secure your filename variable you could try this when using Taint, also added use strict.

    #!/usr/bin/perl -Tw # Now uses Taint and strict use CGI; use strict; my $upload_dir = "/tmp/jobs"; my $query = new CGI; my $email_address = $query->param("email_address"); my $filename = $query->param("photo"); # Upload param check unless($filename =~ /^([^\/\\]+)$/) { print "File Not Writable! at upload param check"; exit; } $filename =~ s/.*[\/\\](.*)/$1/; my $upload_filehandle = $query->upload("photo"); open UPLOADFILE, ">$upload_dir/$filename"; binmode ($upload_filehandle); binmode (UPLOADFILE); while ( <$upload_filehandle> ) { print UPLOADFILE $_; # this was your problem $_ } close UPLOADFILE;
    A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

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

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

    No recent polls found