Ok, I am attempting to write a file upload form, and a cgi script to deal with it. Right now, I am mainly just testing my logic. I am doing my testing on a Redhat Linux 7.2 server running the latest version of Apache. HTML Code for the form and for the script follow:
<HTML>
<HEAD><TITLE>Upload Form</TITLE></HEAD>
<BODY><CENTER>
<FORM METHOD="POST" ACTION="cgi-bin/upload.cgi">
File Name: <INPUT TYPE="FILE" NAME="file">
<BR><BR><BR>
<INPUT TYPE="SUBMIT" VALUE="Submit">
</FORM>
</CENTER></BODY>
</HTML>
And now the script:
#!/usr/bin/perl -w
# I am not using taint yet, but when I get
# ready to deploy this, it will be there
use strict;
use CGI;
my $Q=new CGI;
my $File=$Q->param('file');
# I know what I am sending right now
# so when I turn on tainting, the below
# regex will DEFINITELY be changing
if($File=~/\/root\/text/){
print $Q->header;
print $Q->start_html('File is Correct');
print $Q->h1("File is $File");
print $Q->end_html;
}else{
print $Q->header;
print $Q->start_html('File is Incorrect');
print $Q->h1("File is $File");
print $Q->end_html;
}
The error in the log is stating that the $File variable is undefined, which means that the form isn't passing the name. Please just point me in the right direction, and I should be able to handle it from there.
TStanley
--------
It is God's job to forgive Osama Bin Laden. It is our job to arrange the meeting -- General Norman Schwartzkopf
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.