Hi,
it's a bit hard to help you because without the HTML-Code of the Upload-Site (especially the form), we can't test this here. It doesn't look too bad at first glance, though. Are you getting any error messages on the console?
Some thoughts:
print "\nWe found $cnt images";
# don't "use" the module in the foreach loop otherwise it's done each
+time
use WWW::Mechanize if $cnt > 0;
unless ($cnt > 0) {
print "No images selected\n";
exit 1;
}
my $mech = WWW::Mechanize->new();
foreach my $image (@images)
$cnt2++;
print "\n\t Trying picture $currentdir/$image - $cnt2 of $cnt\n";
$mech->get( $url );
# do you have the correct form here?
print $mech->content;
$mech->submit_form(
form_number => 1, # sure? this could be one problem
fields => {
file => "$currentdir/$image",
category => "$category",
name => "$name",
description => "$description"
}
);
If that does not help, I can only - as always - suggest to use
Corion's
WWW::Mechanize::Shell - it will allow you to interactively fill out the form (on the commandline) and after having done so successfully, automagically print out your steps as valid perl code - for me this is much easier than to write the code in the first place...
Good luck,
svenXY
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.