Click to See Complete Forum and Search --> : Question Regarding running scripts


tlprice
04-12-2005, 10:05 AM
I'm having a problem running a cgi script on my webpage. I'm not sure if I'm putting the correct information in.

--

# START USER EDITS

# absolute path to folder files will be uploaded to.
# WINDOWS users, your path would like something like : images\\uploads
# UNIX users, your path would like something like : /home/www/images/uploads
# do not end the path with any slashes and if you're on a UNIX serv, make sure
# you CHMOD each folder in the path to 777

$dir = "/home/sites/site22/web/demo_uploads";
#$dir = "d:\\html\\users\\html\\images";

# absolute URL to folder files will be uploaded to
$folder = "http://www.yourdomainname.com.com/demo_uploads";

# maximum file size allowed (kilo bytes)
$max = 100;

# for security reasons, enter your domain name.
# this is so uploads may only occur from your domain
# enter any part of your domain name, or leave this
# blank if you don't mind other web sites using your copy
$domain = "";

# if a file is successfully uploaded, enter a URL to redirect to.
# leave this blank to have the default message printed
$redirect = "";

# if you would like to be notified of uploads, enter your email address
# between the SINGLE quotes. leave this blank if you would not like to be notified
$notify = 'upload@yourdomainname.com';

# the name that appears in the e-mail
$adminName = 'Your name';

# the subject of the e-mail notification
$subject = 'Upload Notification';

# UNIX users, if you entered a value for $notify, you must also enter your
# server's sendmail path. It usually looks something like : /usr/sbin/sendmail
$send_mail_path = "/usr/sbin/sendmail";

# WINDOWS users, if you entered a value for $notify, you must also enter your
# server's SMTP path. It usually looks something like : mail.servername.com
$smtp_path = "mail.yourserver.com";

# set to 1 if you would like all files in the directory printed to the web page
# after a successful upload (only printed if redirect is off). Set to 0 if you
# do not want filenames printed to web page
$print_contents = 1;

# allow overwrites? 1 = yes, 0 = no (0 will rename file with a number on the end, the
# highest number is the latest file)
$overwrite = 0;

# file types allowed, enter each type on a new line
# Enter the word "ALL" in uppercase, to accept all file types.
@types = qw~

txt
jpeg
jpg
gif

~;



====
The page cannot be displayed
The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access.

Please try the following:
Contact the Web site administrator if you believe that this request should be allowed.
Make sure that the Web site address displayed in the address bar of your browser is spelled and formatted correctly.
HTTP Error 405 - The HTTP verb used to access this page is not allowed.
Internet Information Services (IIS)

Technical Information (for support personnel)
Go to Microsoft Product Support Services and perform a title search for the words HTTP and 405.
Open IIS Help, which is accessible in IIS Manager (inetmgr), and search for topics titled Setting Application Mappings, Securing Your Site with Web Site Permissions, and About Custom Error Messages.

--

This is the user edits and the error that I recieved. I'm not sure what I am supposed to fill in on the first line, the rest I'm ok with... And this is what I get when I test it.

leocharre
04-15-2005, 08:56 PM
Is this all the code? I'm guessing this is perl, not sh. (CGI is what it does, not what it's written in )
Where is your
#!/usr/bin/perl -w ?
And
use strict; ?

Is this a config file for some program you made?

First thing of all, a perl script has to do something at the end- it has to send the browser some instruction or output.
if you are trying to print to the user agent (browser)
your FIRST output MUST be:
print "Content-type: text/html\n\n";
or you get an error.
You could also redirect by making the first output to the user agent be:
print "Location: http://domain.com\n\n";