Camilo, You are getting the uploaded filename/object, which you should treat as read-only, confused with the final destination on your server that you want to write to. What you want to do is to copy the file, not manipulate it.
Ordinarily, the file is saved by the CGI object in the tmp directory, and only lives as long as your web session. What you want to do is to copy that file to the desired location (that the web server user has permission to write to). If your web server is running as root, change it fast, big fat security hole. Your code would look something like this: `cp $filename $newfilename` # Those are backticks There may be a native Perl function available so you don't have to use the shell command, which is poor form but which works. I use shell commands, but sparingly. Bill -----Original Message----- From: Camilo Gonzalez [mailto:[EMAIL PROTECTED] Sent: Thursday, March 18, 2004 11:57 PM To: CGI Beginners Subject: Uploading file Okay, I'm totally stumped. I'm trying to upload a file using a browser and a file upload field and saving the file to my server. The code is as follows: my $filename = $cgiobj->param('uploaded_file'); my $fh = $cgiobj->upload('uploaded_file'); open (OUTFILE, ">../featImages/$filename") or die "Can't open featImages $filename $!"; while (<$fh>) { print OUTFILE <$fh> or die "Can't print to OUTFILE $!"; } close OUTFILE; The file will be binary. I can get it to print out to STDOUT just fine but I don't want it in my webpage, I want it in the featImages directory. Remember, I'm still a newbie so please be gentle. If you are a crabby person, please don't reply to this. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>