Results 1 to 6 of 6

Thread: Uploading in CGI/Perl

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Posts
    225

    Uploading in CGI/Perl

    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

  2. #2
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    The CGI module has these capabilities, and is part of the standard Perl distribution. Also, the CGI::Lite module handles file uploads.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Posts
    225
    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?

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Posts
    225
    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.

    Code:
    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

  5. #5
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Try
    Code:
    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.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Posts
    225
    Got it, thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width