hi,

i'm trying to upload files with a form using WWW::Mechanize. The form looks like this:

<p><form enctype="multipart/form-data" action="upload.cgi" method="pos +t"> <p><b><u><font face="Arial,Helvetica"><font size=+1> To run a detailed ssSNPer analysis on a single SNP:</font></font></u></b> <p><font face="Arial,Helvetica">Specify the location of your file containing the test SNP rs# (e.g., "<a href="http://fraser.qimr.edu.au/general/da +leN/ssSNPer/rs1800630snp.txt">rs1800630snp.txt</a>"):</font> <br><input name="testSNP" type="file"> <p><font face="Arial,Helvetica">Specify the location of your HapMap SN +P genotype data dump file (e.g., "<a href="http://fraser.qimr.edu.au/gen +eral/daleN/ssSNPer/rs1800630dumpedregion.txt">rs1800630dumpedregion.t +xt</a>"):</font> <br><input name="HapMapData" type="file"> <p><font face="Arial,Helvetica">Please be patient, our web server may +be busy and depending upon the size of your test region your query may ta +ke a few minutes (the example files take ~90 seconds).</font> <br><input type="submit"> </form>
the piece of code i'm using looks like this:
$mech->get( "http://fraser.qimr.edu.au/general/daleN/ssSNPer/" ); $mech->form_number(1); $mech->field("testSNP"=>"/tmp/hapmap/rs11581638_name.txt"); $mech->field("HapMapData"=>"/tmp/hapmap/rs11581638_data.txt"); my $request=$mech->submit(); my $content=$request->content; print $content;
Anyone any ideas why this isn't working?

ta


In reply to WWW::Mechanize and file upload by nosbod

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.