in reply to Re: Re: Re: Upload Question
in thread Upload Question
#!/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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Re: Upload Question
by antirice (Priest) on Nov 04, 2003 at 02:58 UTC | |
by joev (Novice) on Nov 04, 2003 at 23:30 UTC | |
by antirice (Priest) on Nov 05, 2003 at 01:44 UTC |