I need for users to U/L on to my web site via their browser. The code I used to accomplish this is as follows:
## Your path to where you want your files uploaded.
## Note: NO trailing slash
$basedir = "/files";
## Do you wish to allow all file types? yes/no (no capital letters)
$allowall = "no";
## If the above = "no"; then which is the only extention to allow?
## Remember to have the LAST 4 characters i.e. .ext
$theext = ".jpg";
## The page you wish it to forward to when done:
## I.E. $donepage = "
use CGI;
$onnum = 1;
while ($onnum != 11) {
my $req = new CGI;
my $file = $req->param("FILE$onnum"
if ($file ne "" {
my $fileName = $file;
$fileName =~ s!^.*(\\|\/)!!;
$newmain = $fileName;
if ($allowall ne "yes" {
if (lc(substr($newmain,length($newmain) - 4,4)) ne $theext){
$filenotgood = "yes";
}
}
if ($filenotgood ne "yes" {
open (OUTFILE, ">$basedir/$fileName"
print "$basedir/$fileName<br>";
while (my $bytesread = read($file, my $buffer, 1024)) {
print OUTFILE $buffer;
}
close (OUTFILE);
}
}
$onnum++;
}
print "Content-type: text/html\n";
print "Location:$donepage\n\n";
But everytime I test it with Windows NT on a local server I keep getting a error 405 - Method not allowed.
I as well have activeperl installed. Does anyone know where I am going wrong? I am using Apache web server and it works cause I have successfully used other perl scripts. Or does anyone know of another way I can use uploading via a browser.
Thanks in advance,
John Stephens
[sig][/sig]
## Your path to where you want your files uploaded.
## Note: NO trailing slash
$basedir = "/files";
## Do you wish to allow all file types? yes/no (no capital letters)
$allowall = "no";
## If the above = "no"; then which is the only extention to allow?
## Remember to have the LAST 4 characters i.e. .ext
$theext = ".jpg";
## The page you wish it to forward to when done:
## I.E. $donepage = "
use CGI;
$onnum = 1;
while ($onnum != 11) {
my $req = new CGI;
my $file = $req->param("FILE$onnum"
if ($file ne "" {
my $fileName = $file;
$fileName =~ s!^.*(\\|\/)!!;
$newmain = $fileName;
if ($allowall ne "yes" {
if (lc(substr($newmain,length($newmain) - 4,4)) ne $theext){
$filenotgood = "yes";
}
}
if ($filenotgood ne "yes" {
open (OUTFILE, ">$basedir/$fileName"
print "$basedir/$fileName<br>";
while (my $bytesread = read($file, my $buffer, 1024)) {
print OUTFILE $buffer;
}
close (OUTFILE);
}
}
$onnum++;
}
print "Content-type: text/html\n";
print "Location:$donepage\n\n";
But everytime I test it with Windows NT on a local server I keep getting a error 405 - Method not allowed.
I as well have activeperl installed. Does anyone know where I am going wrong? I am using Apache web server and it works cause I have successfully used other perl scripts. Or does anyone know of another way I can use uploading via a browser.
Thanks in advance,
John Stephens
[sig][/sig]