Thanks for being persistent! This is exactly the kind of thing I've been looking for as an example!

I find it kind of interesting that you get around the thing I didn't see in HTML::Form by going and getting the form and then searching it for the right thing and filling it out blindly. I hadn't thought of doing that; it would be good errorchecking - make sure you can get to the site before submitting.

For reference, here is some code I wrote when I was still trying to use libwww-perl (it didn't work, can you tell me why? (serious query)):

#!/usr/bin/perl use HTTP::Request::Common; use LWP::UserAgent; use CGI qw(header -no_debug); my $URL = 'https://www.mydomain.com/upload.html'; my $req = POST $URL, Content_Type => 'form-data', Content => [ user => 'username', pass => 'password', FILE => ['./binaryfile'], # this file will be uploaded ]; my $res = LWP::UserAgent->new->request($req); print header, $res->is_success ? $res->content : $res->status_line;

Yes, yes, Carp, strict, -w and all that. Consider it read, for conciseness' sake. Maybe I'll try it again using HTML::Form.


In reply to RE: (jcwren) RE: amelinda's problem (I am a hardheaded SOB) by amelinda
in thread amelinda's HTTP/MIME/file upload/not-a-cgi-but-a-client/minimal-module/perl problem by amelinda

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.