OK, I was able to find an
open source uploader and intercept the header before it printed. Here' where I put the code:
if ($action eq 'admin') {
print $query->header;
if ($login && $password) {
&admin($query, $login, $password);
} else {
print &PagePassword($NAME_TITLE{'common_admin'});
}
} elsif ($action eq 'upload') {
##### My code begins #####
use CGI qw(:cgi);
use strict;
`perl newimg2db.pl > newimgseekurl.txt`;
sleep 1 while ( !(-e "newimgseekurl.txt") );
use File::Copy;
copy("newimgseekurl.txt", "newimgseekurl2.txt") or die "File canno
+t be copied.";
my $file = "newimgseekurl.txt";
unlink($file);
open FILE, "newimgseekurl2.txt" or die "Couldn't open file: $!";
my $newimgseekurl = <FILE>;
close FILE;
print redirect("$newimgseekurl");
##### My Code Ends #####
if ($dir = &check_password('guest', $login, $password)) {
print &Upload($query, $dir);
} else {
print &BadPassword($NAME_TITLE{'common_member'});
}
} else {
print $query->redirect($FORM_URL);
This did not prevent the file from uploading and did properly redirect. Thanks for the help, views and voting.
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.