D
D Borland
Hi again folks,
I'm trying to get the script below to work. I've checked it's syntax and
perl says that it's ok, i cannot check the logs on the server as 1&1
webhosting don't seem to allow me that, as when i run the script i get a
server 500 error, with no info on why
I've checked to see if the script
still managed to upload the file which it did... any ideas?
Thanks for your time.
__CODE__
#!/usr/bin/perl
use strict;
use warnings;
use CGI;
use CGI::Carp 'fatalsToBrowser';
$CGI:
OST_MAX = 1024 * 500;
my $query = new CGI;
my $filename = $query->param('image1');
my $fileToUpload = $query->upload('image1');
my $uploadDir = "$ENV{'DOCUMENT_ROOT'}/beta";
$filename =~ s/.*[\/\\](.*)/$1/;
open(NEWFILE, ">$uploadDir/$filename")
or die "Cannot create new file $uploadDir/$filename : $!\n";
binmode(NEWFILE);
while (<$fileToUpload>) {
print NEWFILE;
}
close(NEWFILE);
print $query->p("File uploaded");
__END__
I'm trying to get the script below to work. I've checked it's syntax and
perl says that it's ok, i cannot check the logs on the server as 1&1
webhosting don't seem to allow me that, as when i run the script i get a
server 500 error, with no info on why
still managed to upload the file which it did... any ideas?
Thanks for your time.
__CODE__
#!/usr/bin/perl
use strict;
use warnings;
use CGI;
use CGI::Carp 'fatalsToBrowser';
$CGI:
my $query = new CGI;
my $filename = $query->param('image1');
my $fileToUpload = $query->upload('image1');
my $uploadDir = "$ENV{'DOCUMENT_ROOT'}/beta";
$filename =~ s/.*[\/\\](.*)/$1/;
open(NEWFILE, ">$uploadDir/$filename")
or die "Cannot create new file $uploadDir/$filename : $!\n";
binmode(NEWFILE);
while (<$fileToUpload>) {
print NEWFILE;
}
close(NEWFILE);
print $query->p("File uploaded");
__END__