CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
"use strict" and file uploading

 



photores
Deleted

Jan 26, 2001, 4:11 PM

Post #1 of 1 (656 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;


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives