From: Vasudevan C. <vco...@gm...> - 2018-04-09 18:53:38
|
Hi All, I am creating a Web Request object with the URL and the method is set to POST and setting the FormEncoding Type to MULTIPART. How do I upload a file?. I know the name of the file and its path. DO I need create a dummy form with a submit Button? I appreciate your help. Regards Vasu On 25 January 2018 at 01:11, Ronald Brill <rb...@rb...> wrote: > yourWebRequest.setEncodingType(FormEncodingType.MULTIPART); > > Hope the same methods are available in your old version also > > RBRi > > On Thu, 25 Jan 2018 01:08:33 +0530 Vasudevan Comandur wrote: > > > >Hi Ronald, > > > > I am constructing my own WebRequest with HTTPMethod set to POST. > > > > I construct the NameValue Pair and POST the request. I see HTMLUnit > set > >the content-type to x-form-encoded in this case. > > > > However, I want the similar feature to construct a > >multi-part/formencoded content-type in HTMLUnit. Is it possible? > > > > I have another question. For one of the sites, the client(javascript) > >is setting a cookie value and sending it to the server. Is it possible > > in HTMLUnit to add that cookie to the cookie manager of Webclient > >using addCookie Method?. Will that work. Because, such a call does > > not set the Cookie in HTMLUnit in later version. Earlier versions of > >HtmlUnit 2.9, I was able to do that. > > > > Looking forward to your reply. > > > >Regards > > Vasu > > > > > > > > > >On 25 January 2018 at 00:57, Ronald Brill <rb...@rb...> wrote: > > > >> Hi Vasu, > >> > >> i'm not sure that i got your point. > >> Do you like > >> * to manipulate the form before clicking the submit button or > >> * have you created your own WebRequest and like to change the encoding > >> type? > >> > >> Maybe you can illustrate your ide with some (pseudo) code > >> > >> RBRi > >> > >> BTW: 2.29 and 2.30 is on the way > >> > >> > >> >Hi, > >> > > >> > I have been using htmlunit 2.23 version. I wanted to know if it is > >> >possible to set > >> > the content-type as multipart/form-data in HTTPRequestHEader and > post a > >> >form. > >> > > >> > Is it possible to achieve the above scenario without creating a > sample > >> >html file > >> > and click on the submit button? > >> > > >> > Thanks for your input & suggestions in advance. > >> > > >> >Regards > >> > Vasu > >> > >> > > > > > > |