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

I have a internal website that just requires the user to enter a directory. From there I know which files to upload. Is this possible without the use of an html form? More specifically can I simply call $cgi-upload and pass it the file names needed?
Thanks,

Replies are listed 'Best First'.
Re: cgi file upload without a form
by MidLifeXis (Monsignor) on Jan 13, 2011 at 18:04 UTC

    Perhaps with a plugin, but in general, no.

    Consider the case where you visit a site. Should the site be able to specify that it wants to grab c:\autoexec.bat (or worse) from your system, or should you, the user, instead be required to pass the file to the server.

    As I said, however, with a plugin, all bets are off.

    --MidLifeXis

Re: cgi file upload without a form
by ww (Archbishop) on Jan 13, 2011 at 18:08 UTC
    Underspecified. Ambiguous.
    1. "to enter a directory" - a directory WHERE? On the server? on the client?
    2. "I know which files..." - oh, how?
    3. "... to upload" - errrrm... transfer from the server to the client, or the otherway around?

    This makes sense to me only if you have hardcoded files to download from the server to the client, based on the user's selection of a directory (from a menu? psychic choice?) in which case, this seems to be a case of needlessly going all around Robin Hood's barn. Wouldn't it be more direct to render, as a list of options, the files available to download with explanations of their relevance, utility or some other descriptive language?

    And...
    What have you tried? WHere's the code?
      C'mon. Have a heart. Have you considered? Maybe he's trying to create spyware or some virus software? :)
        Sorry.

        Admission to the SpyWare Makers' Guild requires some evidence of aptitude. The Virus Writers Conglomerate has a somewhat similar pre-req: demonstrated competence in producing some form of malware.

        :-)
        I can assure you this isn't spyware. Basically this is my scenario. We have a set of test results with static names that get written to a new directory after every test run. After the test run we need the ability to point at a specified directory and upload the required files...like I said we know which ones we need. The way I'm currently doing it is uploading one file at a time. This is not only time consuming but makes it easy to make a mistake.
        Any thoughts?