Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbi needs help with File Upload

Status
Not open for further replies.

BosFidel

Programmer
Jul 29, 2003
1
US
Hi fellas,
I'm about 2 weeks old in the perl/cgi world and am just starting to figure this out. My file upload code doesn't want to work. When I run the script, the name of the file gets saved in the desired location. However, it always uploads with 0 bytes! Heres the code, any help would be greatly appreciated!


#!/mgs/sw/bin/perl -w
my $attachment1= $q->param('Fileone');

if($attachment1)
{
$attachment1=~ s/.*[\/\\](.*)/$1/;

my $file = $q->upload('Fileone');

my $upload_dir = "../Newswatch/Jobs/$path";

open(UPLOAD, ">$upload_dir/$attachment1");
binmode UPLOAD;
while ($file)
{
print UPLOAD ;
}
close (UPLOAD);
}
 
There are a couple of faqs in the Perl forum about this. You might take a look. ......come back with any questions.


'hope this helps

If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top