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

Is it possible to use LWP UserAgent to do a form upload (specifically a browser based file file upload via a an html form), and if so how? I can't seem to figure out how one would pipe the file into it and if there's supposed to be any encoding or not, the RFC on browser based form uploads doesn't seem to help in checking if the lwp module has built in support for it. Any help would be appreciated. Chris Miseresky

Replies are listed 'Best First'.
Re: Using Libwww for a Form Data Upload
by merlyn (Sage) on Apr 14, 2001 at 05:20 UTC
Re: Using Libwww for a Form Data Upload
by princepawn (Parson) on Apr 17, 2001 at 00:59 UTC
    you need:
    use HTTP::Request::Common qw(POST)
    because you will be posting to the webserver. POST takes a URL and an array ref which it turns into a query string:
    POST $url, [ data => `cat binary_file.dat`, user => jimbo, pass => heehaw ];