Re: Invalid file upload

Russell Gold <[email protected]>
Newsgroups gmane.comp.web.httpunit.devel
Message-ID <[email protected]>
On Mar 20, 2006, at 10:53 PM, Martin Olsson wrote:

> Hi,
>
> I have a form on my webpage where the user can upload a file.  
> Sometimes user write the filename (+ path) manually. Of course  
> these filenames (+paths) are sometimes invalid so in the .php  
> script I check if the uploaded file was valid or not. If it wasn't  
> valid I print "Bad file upload".

Um, doesn't the browser do that for you? How would a user submit a  
bad file?

>
> I have written tests for all the forms on my webpages. For instance  
> it tries to login with a username and makes sure that a "you must  
> specify username" text appears and so on.
>
> Now, I would like to implement a similar test for the file upload  
> box. I want to have httpunit manually write something like  
> "hello" (or any non-existent filename) and submit the form in order  
> to assert that the "Bad file upload" message really appears properly.
>
> The problem is that the httpunit form setparameter function only  
> accepts File() objects that refer to an existing file.
>
> How can I have HTTPUNIT submit a form with a faulty file upload?
>
>
>
> regards,
> martin
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting  
> language
> that extends applications into web and mobile media. Attend the  
> live webcast
> and join the prime developer group breaking into this new coding  
> territory!
> http://sel.as-us.falkag.net/sel? 
> cmd=lnk&kid=110944&bid=241720&dat=121642
> _______________________________________________
> Httpunit-develop mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/httpunit-develop
>



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.