Okay ... There seems to be a couple of issues here - The first is the location of the file which you are looking to upload. From the code snippet you have given us, it would appear that the file is already on the web server and it from from there that it is to be uploaded elsewhere - This however, is not what I think you are wanting to achieve. From comments in your code, it looks like you are wanting to upload a file from the web client's machine to the web server, something which the code above is unable to perform - The reason for this is because this CGI code when executed is executed on the web server and not on the client's machine. As such, all references to files residing on the client system are invalid.
As the author of CGI::Upload however, I would think that it should be able to do exactly what you desire - For example, the snippet of code returns a file handle to the file uploaded through the file input field named 'form_file_upload_field' on your HTML form:
use CGI;
use CGI::Upload;
my $cgi = CGI->new;
my $upload = CGI::Upload->new($cgi);
my $fh = $upload->file_handle('form_file_upload_field');
In addition to this, example usage of this module can be seen in this thread - If you have any questions regarding the CGI::Upload module, please feel free to contact me via email or /msg.
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.