Re: uploading a file with perl

[email protected] (Gunnar Hjalmarsson)
Newsgroups perl.beginners.cgi
Message-ID <[email protected]>
Mike Williams wrote:
> On Jan 12, 2008 9:33 PM, Sean Davis wrote:
>> You should probably be using CGI.pm.  It will vastly simplify what you are
>> doing.  Then, you can read any of a dozen sites on doing file uploads using
>> CGI; see search.cpan.org for the details of using CGI.pm.
> 
> I agree with Sean.  You have 'use CGI' in your code, but you don't
> actually use it, you really should.

Or use CGI::UploadEasy, which is a wrapper around the upload 
functionality of CGI.pm.

> Notice that the upload code using CGI is about one third the length of
> your non-working code.
> There should be more error checking added, but it is up and limping.
> 
> You should look at the perldoc for CGI.   In particular search for MAX
> (with /MAX) and read the section about settint the maximum size of
> uploads.

All that would be taken care of by CGI::UploadEasy. And significantly 
less code - see http://search.cpan.org/perldoc?CGI::UploadEasy#EXAMPLE

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.