help with perl
From: News sender (renping.liu_at_eng.ox.ac.uk)
Date: 04/20/04
- Next message: Tim Haynes: "shell-wank (Re: How to become a System Administrator?)"
- Previous message: jpd: "Re: How to become a System Administrator?"
- Next in thread: Barry Margolin: "Re: help with perl"
- Reply: Barry Margolin: "Re: help with perl"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 20 Apr 2004 10:54:30 +0100
Hi there,
I am using CGI and Perl for uploading files. The Perl code is included.
The code works fine on PC and Linux (both run apache 2.0.39). But when I run
the code on Unix (solaris7, also run Apache2.0.39), only the filename is
uploaded, not the contents:
-rw------- 1 nobody nobody 0 Apr 19 16:10 file1
-rw------- 1 nobody nobody 0 Apr 19 16:35 file2
You can see the file names are right: file1, file2. But the size of each
file is 0.
The permission of the directory is set as 777:
drwxrwxrwx 2 nobody nobody 512 Apr 2 15:33 shared
There is no error messages in the Apache log files.
Does anyone see this problem before? Any help is appreciated.
Many thanks.
-----------------------------------------------------------
#!d:/Perl/bin/Perl.exe
use CGI;
$query = new CGI;
$filepath = $query->param ('filename');
if ($filepath =~ /([^\/\\]+)$/)
{
$filename="$1";
print "The file name is: ", $filename, "<br>";
}
else
{
$filename="$filepath";
}
# check the existence of the file
if (-e "../htdocs/sharedfiles/$filename")
{
print "A file with the same name exists, please rename your file.",
"<br>";
}
else
{
# open the file and load it
open (OUTFILE,">../htdocs/sharedfiles/$filename ");
binmode(OUTFILE);
while ($bytesread=read($filepath,$buffer,1024)) {
print OUTFILE $buffer;
}
close OUTFILE;
print "Your file has been successfully uploaded.", "<br>";
}
- Next message: Tim Haynes: "shell-wank (Re: How to become a System Administrator?)"
- Previous message: jpd: "Re: How to become a System Administrator?"
- Next in thread: Barry Margolin: "Re: help with perl"
- Reply: Barry Margolin: "Re: help with perl"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|