Thanks for your attention to this post. Its very appreciated. Unfortunately, it hasnt resolved itself. I've done some testing of my own extrating just the portion of the script that uploads a file and check the content-type printing out the value of $type. It consistantly comes up as undef. My code is now:
sub upload_image {
## pull the file in a variable
my $fh = $query->param('upload');
## determine the file type via the headers
my $info = $query->uploadInfo($fh);
my $type = $info->{'Content-Type'};
## take action based on type
if ($type =~ m|text/html|i) {
## hash of file names to write to
my %destination = ( 'match' => "match.html", 'no_match' => "no_mat
+ch.html");
## open the file to be written
open(HTML, ">/path/to/$destination{$formdata{fi
lename}}")
or die "Cant open HTML file for writing : $!\n";
## if file is determined to be text/html write contents to appropr
+iate locat
ion
while(<$fh>) {
print HTML "$_\n";
}
close(HTML);
## otherwise set error for later notification within html
} else {
$error = "|$type|";
}
}
I've tried several different kinds of files, and still to no avail. When I print out the value of $error, i just end up with || making me believe that its being returned as undef. I'm going to keep hammering on it, but I am bewildered as to what is happening.
thanks -c
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.