PDA

Click to See Complete Forum and Search --> : Uploading in CGI/Perl


git
May 16th, 2002, 11:57 PM
Hiyas,

I'm trying to look for some Perl/CGI code which can upload files via a form. I've checked cgi-resources.com, but a lot of the scripts there were for submitting files via a form to be emailed or something like that. All I'm looking for is simple code that can get a file (or files) from a form, check the file size(s), and save the file(s) to the server.

I've also found some code that does this but uses a Perl module (I think that's what they're called - I don't know much Perl yet), in a seperate file, but I'm after code which is kept entirely within the one file/script.

Can anyone help? I'd really appreciate if I could get some help with this!

Thanks.

-Git

JoshT
May 17th, 2002, 11:02 AM
The CGI module has these capabilities, and is part of the standard Perl distribution. Also, the CGI::Lite module handles file uploads.

git
May 17th, 2002, 09:11 PM
Thanks guys. I'm going to use CGI Lite actually, since it's fairly simple from what I've seen! What's the newest version, 2.0, right?

git
May 19th, 2002, 08:41 AM
Alright, I've got CGI Lite 2.0 working with my scripts and it's fine. At the moment the code at the top of my scripts looks like this, and the CGI Lite module (Lite.pm) is in the same directory as the scripts.


use Lite;
$cgi = new CGI::Lite;


This works... However, I want to put the CGI Lite module into the next directory up a level (ie. this directory is a subdirectory of it). What do I need to change the code to so it looks for the module in the next directory up?

Thanks,

-Git

JoshT
May 20th, 2002, 10:55 AM
Try use '../lite.pm'; (or whatever the actual CGI::Lite file name is). Else you can manipulate the @INC array that contains paths to search for modules.

git
May 20th, 2002, 11:59 PM
Got it, thanks! :)