Firstly, your error message:
From the CGI docs:
To be safe, use the upload() function (new in version 2.47). When cal
+led with the name of an upload field, upload() returns a filehandle,
+or undef if the parameter is not a valid file-
handle.
You probably have an old version of the CGI module which does not support the upload function.
If upgrading is not possible, there is an alternative method which is also described in the docs. However, there are several other problems with your code. Here is a short list of just the ones I can see (I'm sure other Monks will point out more)
- You are not actually printing anything to your UPLOADFILE
- You are not testing for success when you open your filehandle.
- You are not using strict. Always use strict - it will help you pick up many errors in your code.
- You have not enabled taint checking. This is very important whenever your script will accept data from the "outside world"
I'd strongly recommend you work your way through a few CGI tutorials to learn some more. A couple of good ones:
Hope this helps,
Darren :)
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.