
photores
Deleted
Jan 26, 2001, 4:11 PM
Post #1 of 1
(502 views)
|
|
"use strict" and file uploading
|
Can't Post
|
|
Hi! I try use standard code for file uploading wia form (see below). It work, if I run code wihtout pragma "use strict". Only I swich on "use strict", it create output file, but don't read any bytes from surce. Please, help. Code is below: package Package; use strict; use CGI qw(:sandard); sub new{...} sub some_sub { my $image; #------------------# #------------------# my $no = &get_no(); # this variables is my $dir = &get_dir(); # present for all variants my $dir = "$dir/temp"; $image = &img_up($dir,$no); #-----------------# #-----------------# } sub img_up { my $dir = shift; my $no = shift; my $file = param("img_$no"); my($buffer,$bytesread); my @pathName = split(/\\/,$file); my $newFile = pop(@pathName); if($file) { open(OUTFILE,">$dir/$newFile")||die "Can not open $newFile. $!"; while($bytesread = read($file,$buffer,1024)) { print OUTFILE $buffer; } close(OUTFILE); return $newFile; } } 1;
|