Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

How do you test an upload form?

by hesco (Deacon)
on Mar 10, 2006 at 22:12 UTC ( [id://535829]=perlquestion: print w/replies, xml ) Need Help??

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

In reviewing the perldoc for WWW::Mechanize and WWW:Mechanize::FormFiller, I can't find anywhere that advises how to automate a test of a file upload form.

I'll want to validate the file for file type, permissions, length and probably even content, once its uploaded, but to test and exercise those validation functions (which I haven't written yet), I need an automated way of uploading a file to such a form.

Can anyone here please advise how I would do this? Thanks,

-- Hugh

Replies are listed 'Best First'.
Re: How do you test an upload form?
by davidrw (Prior) on Mar 11, 2006 at 01:00 UTC
    Are you sure that WWW::Mechanize doesn't support it? i.e., did you try it (what was the error if any?)? I haven't, but i see in the docs for $mech->value() that it says:
    If the field is of type file (file upload field), the value is always cleared to prevent remote sites from downloading your local files. To upload a file, specify its file name explicitly.
    So mayb just using set_fields() or submit_form() normally with one of the values being the filename will do the trick?
Re: How do you test an upload form?
by cees (Curate) on Mar 12, 2006 at 19:25 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://535829]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2025-06-19 10:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.