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

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Sounds like $q->uploadInfo($fileName) is returning "undef" rather than the expected hash reference. Given that you've already extracted that value into $fileInfo a few lines earlier, it might make sense to check that you've got what you hope you've got (i.e. a hash reference) before going ahead and trying to dereference it. I've always thought that the example in the CGI.pm docs that calls uploadInfo and just assumes that it works seemed a bit reckless, so I've always done that in two stages.

All of which leaves you having to work out why you're getting "undef" rather than a useful value. Without seeing more of your code it's hard to be much help, but one idea springs to mind. It looks a bit unusual creating a CGI object in your fileUpload subroutine. Usually, you'd do that at the start at the CGI program and just pass that object around. Are you also creating a CGI object elsewhere in your program? You can only create one CGI object from each HTTP request. If you try to create a second one then all of its attributes will be undefined. Is that what has happened here?

--
<http://dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg


In reply to Re: CGI.pm - uploadInfo() - Simply not working by davorg
in thread CGI.pm - uploadInfo() - Simply not working by wigwam

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? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2023-06-06 09:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you go to conferences?






    Results (26 votes). Check out past polls.

    Notices?