Ok, heres the script I have so far. It uses CGI.pm and passes through a text variable and tells me the file name thats going to be uploaded. It works great. (so far). How do I upload the file to the UPLOAD_DIR?
Genius wanted.....:)
Form:
AS a form should be, using...
input type=file name=file
input type=text name=var1
Script:
#!/usr/bin/perl
use CGI;
use constant BUFFER_SIZE => 16_384;
use constant MAX_FILE_SIZE => 48_576;
use constant UPLOAD_DIR => "/absolute/path/to/";
$CGI::DISABLE_UPLOADS = 0;
$CGI::POST_MAX = MAX_FILE_SIZE;
my $req = CGI->new;<br>
my $var1 = $req->param('var1');
my $file = $req->param("file");
if ($file) {
my $buffer;
my $file_handle = $req->upload( $file );
my $format = $req->uploadInfo($file)->{'Content-Type'};
}
print "Content-type: text/html\n\n";
print "Passed Variable = $var1<p>";
print "File name = $file<p>\n";
exit;
Sooo close!!!.......
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.