#!/usr/bin/perl -w use strict; use CGI; use Fcntl; my $formdata = CGI->new; my $file = $formdata->param('file'); my $filename = $formdata->param('filename'); #user supplied fi +le name my $fh = $formdata->upload('file'); my $upload_dir = "/var/www/html/eface/client_pics/"; my $buffer = ""; print $formdata->header(); print STDERR "$file\n"; print STDERR "$filename\n"; if (defined $fh){ print STDERR "\$fh is defined\n"; } # Open the file to be wriiten into the upload directory sysopen OUTPUT, $upload_dir . $filename, O_CREAT | O_EXCL; # Write file to upload directory while (read ($fh, $buffer, 16384)){ print OUTPUT $buffer; } close OUTPUT;
This code still gives me the file named $filename in my upload directory $upload_dir but it still contains 0K byte size.
Now when I run in my code:
while (<$fh>){ print; }
it does print out data to the browser so I know that the temporary file is being found. I can't quite solve this. Any Ideas?
Thanks Again for everyones help.
Joe
In reply to Re: Re: Re: Re: Upload Question
by joev
in thread Upload Question
by joev
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |