giobis has asked for the wisdom of the Perl Monks concerning the following question:

Hi you all, How I can use the cgi::upload module ? I must create a form for upload file from Browser into Server. I see the cgi:upload module but I don't understand How I can use it. I accept all your suggestions :) Many thaks to all

Replies are listed 'Best First'.
Re: Create an upload Form
by blue_cowdawg (Monsignor) on Oct 09, 2006 at 13:34 UTC
        Hi you all, How I can use the cgi::upload module ? I must create a form for upload file from Browser into Server.

    This is one of those areas that some understanding of the principles is exceedingly important before you step off due to the inherent dangers in what you are trying. Sort of like making sure you understand how a parachute works before going skydiving.

    There are two crucial elements that you need to understand. First off is how to write the form in the first place. You can approach that from two directions. Purely an HTML coded page to wit I'd recommend you look at some of the on line resources pointed to by this CPAN search.

    Another approach to creating this form can be learned by reading the documentation that comes with the CGI module. Please note the same script that processes the file upload can generate the form. An all in one solution!

    There are numerous tutorials on CGI programming itself both here at the Monastery including this one and this offsite link.

    Next you need to understand the security ramifications of what you are doing and be ready to deal with them. File uploads in my experience are one of the more popular things people want to implement and sadly the folks that want to implement them often don't understand the dangers.

    I hope this nudges you in the right direction, I know I haven't "spoon fed" you a solution. I restrained myself from doing so intentionally since I want you to fully consider and understand what you are doing before you try and do it and fall into some sort of grief.


    Peter L. Berghold -- Unix Professional
    Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg
Re: Create an upload Form
by Melly (Chaplain) on Oct 09, 2006 at 15:13 UTC

    There's an upload perl script on my site at: tomandlu.co.uk

    I think it's pretty secure and easy to use - heh, any perlmonkees want to take a look at it and comment?

    Tom Melly, tom@tomandlu.co.uk