[Perl-unix-users] Off the subject, Upload File CGI
by Henry Wong, ¶À³Ç¼e other posts by this author
Aug 26 2003 8:53PM messages near this date
[Perl-unix-users] Undefined value, I can't see my mistake
|
Re: [Perl-unix-users] Off the subject, Upload File CGI
For some reason when I upload a file and save it on
/tmp/test.jpg, it save it as a zero byte file. Does
anyone have a suggestion how I can debug this?
#!/usr/bin/perl
use strict;
use Image::Size;
use CGI qw/:standard/;
my $IS_MODPERL = $ENV{MOD_PERL};
*exit = $IS_MODPERL ? \&Apache::exit : sub {
CORE::exit };
my $cgi = new CGI;
my $file = $cgi-> param('file');
my ($buffer, $byte);
{
no strict;
open (FH, "> /tmp/test.jpg");
my $buffer;
while (read $file, $buffer, 1024) {
print FH $buffer;
};
};
my ($x,$y,$z) = imgsize('/tmp/test.jpg');
print $cgi-> header;
print "$x , $y, $z";
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
_______________________________________________
Perl-Unix-Users mailing list
Perl-Unix-Users@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Henry Wong, ¶À³Ç¼e
$Bill Luebkert
|