Perl/CGI file upload

Discussion in 'Perl Misc' started by Jerome, Mar 20, 2007.

  1. Jerome

    Jerome Guest

    Hi!

    I am in need of a special file upload script using Perl.

    The script needs to allow uploading any files from a form (without
    knowing the form structure in advance) - basically *any* files given
    to it.

    I just need some short documented source code as a hint so that I can
    go and do the rest of the research, but so far I found nothing which
    handles forms without knowing the forms themselves.

    Thanks!

    -gratemyl
     
    Jerome, Mar 20, 2007
    #1
    1. Advertising

  2. Jerome

    Guest

    On Mar 20, 12:30 pm, "Jerome" <> wrote:
    > The script needs to allow uploading any files from a form (without
    > knowing the form structure in advance)


    If a form envokes a CGI script, it will pass all the HTML parameters
    (the names/values of which may be discovered via the param() method of
    CGI.pm). If the form contains only filefield-type params then you may
    simply process each parameter with the file upload functionality of
    CGI ('perldoc CGI' will show you the sample code you asked for).

    The problem would be if you have a mixture of form-type elements, such
    as file-fields for pictures and text-fields for captions. If you
    don't know the structure of the form (and thus the names of the
    parameters) then it's not easy (or maybe not even possible) to
    reliably distinguish which parameters are filenames and which are not.

    > basically *any* files given to it.


    Egads.

    --
    The best way to get a good answer is to ask a good question.
    David Filmer (http://DavidFilmer.com)
     
    , Mar 20, 2007
    #2
    1. Advertising

  3. Jerome

    Jerome Guest

    On Mar 20, 9:11 pm, wrote:
    > On Mar 20, 12:30 pm, "Jerome" <> wrote:
    >
    > > The script needs to allow uploading any files from a form (without
    > > knowing the form structure in advance)

    >
    > If a form envokes a CGI script, it will pass all the HTML parameters
    > (the names/values of which may be discovered via the param() method of
    > CGI.pm). If the form contains only filefield-type params then you may
    > simply process each parameter with the file upload functionality of
    > CGI ('perldoc CGI' will show you the sample code you asked for).
    >
    > The problem would be if you have a mixture of form-type elements, such
    > as file-fields for pictures and text-fields for captions. If you
    > don't know the structure of the form (and thus the names of the
    > parameters) then it's not easy (or maybe not even possible) to
    > reliably distinguish which parameters are filenames and which are not.


    I can assume that all but one specific one are.

    >
    > > basically *any* files given to it.

    >
    > Egads.
    >
    > --
    > The best way to get a good answer is to ask a good question.
    > David Filmer (http://DavidFilmer.com)
     
    Jerome, Mar 20, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lionel Valero

    perl CGI file upload memory leak

    Lionel Valero, Nov 11, 2003, in forum: Perl Misc
    Replies:
    11
    Views:
    304
    Lionel Valero
    Nov 12, 2003
  2. Sokar

    upload file with perl cgi

    Sokar, May 10, 2004, in forum: Perl Misc
    Replies:
    4
    Views:
    145
    Sean Berry
    May 11, 2004
  3. Avin Patel
    Replies:
    4
    Views:
    948
    Brian McCauley
    Nov 5, 2004
  4. Jerome

    Perl/CGI file upload

    Jerome, Mar 20, 2007, in forum: Perl Misc
    Replies:
    7
    Views:
    196
    Gunnar Hjalmarsson
    Mar 21, 2007
  5. kath
    Replies:
    4
    Views:
    641
    J. Gleixner
    Apr 9, 2007
Loading...

Share This Page