ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-unix-users
perl-unix-users
[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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved