Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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


In reply to Re: Re: using uploadInfo from CGI.pm by c
in thread using uploadInfo from CGI.pm by c

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2024-03-29 12:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found