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

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
(ar0n) Re: Receiving POST
by ar0n (Priest) on Jul 18, 2001 at 12:42 UTC
Re: Receiving POST
by agoth (Chaplain) on Jul 18, 2001 at 12:57 UTC
    ???? wow ???
    One word upload.....
    There are enough links to sink a battleship..
Re: Receiving POST
by toadi (Chaplain) on Jul 18, 2001 at 13:02 UTC
    Ok Ok I get it. But what I meant is that I don't know to what param they post to. I just need to be listening for a post with a file comming in. I know that with CGI.pm you can do a file upload via a form, but what I didn't know was if you just can listen for any post request!!!!

    Maybe this is a stupid question and can't be done!!!

    --
    My opinions may have changed,
    but not the fact that I am right

Re: Receiving POST
by shotgunefx (Parson) on Jul 18, 2001 at 12:49 UTC
    I was about to scold you for not using Search but I only received two results for "upload file"?! .

    The documentation for CGI.pm has a few examples or you can look at this node for an example.

    I would definetly recommend using the CGI module as opposed to rolling your own unless it's for learning purposes.

    Update

    Minutes later, the site went down and I was greeted by the visage of the node reaper, maybe that's why the weak search results.

    -Lee

    "To be civilized is to deny one's nature."
Re: Receiving POST
by Sinister (Friar) on Jul 18, 2001 at 15:13 UTC
    a CGI script is started on request of the webserver.
    You should build an HTML page, containing a file input type (make sure the form tag contains: ENCTYPE="multipart/form-data") and a cgi script. ready to receive a paramter (file) by what ever name you gave the file input field

    Have fun fiquring the pitt-falls out... ;-)

    Sinister greetings.
    perldoc -q $_
      So know that *duh*. I know howto write a file upload script...

      But someone sends XML with a post to my cgi|pl&url script. I just want to receive the file in a stream or something like that. Not in a file just a stream like to print to STDOUT that I immediatly can use.

      That must be possible without HTML page!!!

      Maybe my I can't explain properly what I mean *sigh*


      --
      My opinions may have changed,
      but not the fact that I am right

        I think you are misunderstanding how CGI works. HTML is just a user interface for the web. When a user has an HTML form, the browser takes that information and creates a POST request from the form data.

        You don't need an HTML form to send a post. You could generate an appropriate one yourself. One quick easy way to do it would be to have the sender code use LWP to make the POST request and use a regular CGI to process it.

        -Lee

        "To be civilized is to deny one's nature."
Re: Receiving POST
by MZSanford (Curate) on Jul 18, 2001 at 17:34 UTC
    correct me if i am wrong (it does happen alot), but it appears you want someone else to POST a file to you without ever visiting your site ... using the HTTP POST method as a filetransfer without a UI, right ? If not, skip the rest, if so, Read on :

    First off, i have never done this, so what i am about to say is all guesses, thoughts and conjecture ... but thats what code is made of. To start with the obvious, HTTP is not really built for this, and FTP would probably be a better solution over all ... but assuming there is a reason this is not being used (and a good one i would hope), you could setup a form which uses the statdard upload faeture , but use </code>Vars</code> method to get all params and the use the keys of the hasref returned to find the vaild one. That will allow someone to post to url/script.pl?foo=file or url/script.pl?bar=file if correctly implimented.

    Hope that helps
    OH, a sarcasm detector, that’s really useful