sub upload_file { $| = 1; #flush the output buffer my $sourcefile = shift; my ($buffer, $bytes); $sourcefile =~ /([\w .-]+)$/i; #strip off path stuff my $newfile = $1; $newfile =~ s/ //; open (OUTFILE, ">../$newfile") or die "Cannot open $newfile: $!"; # binmode(OUTFILE); while ($bytes = read($sourcefile, $buffer, 1024)) { print OUTFILE $buffer; } close($sourcefile) or die "Close:$!";; close(OUTFILE) or die "Close:$!";; chmod (0666, ">../$newfile"); return $newfile; } #### $stmt ="LOAD DATA LOCAL INFILE '../catalog.txt' INTO TABLE catalog LINES TERMINATED BY '\r'IGNORE 1 LINES";