To ensure that the sessions cookie (assuming one is being used) is sent to the post you just need to use the same instance of HttpClient for both posts. You can verify that the session cookie is being sent by looking at the wire log <http://jakarta.apache.org/commons/httpclient/logging.html>.
Mike
On Feb 15, 2004, at 2:51 AM, Stefan Bachem wrote:
Hello
I want to Upload a File to an Server, for this my Programm has to act as an WWW Browser. First I have to Authentificate myself over a https connection . I do so and get a session cookie .
After this I try to call the Upload Site, but then again the Server tells to Authentifcate me.
At this Time my only Action about cookies is: client.getState().setCookiePolicy(CookiePolicy.COMPATIBILITY);
Do I have to hand out the Session Cookie to the Server manual?
The html code of the Upload Site:
<form method="POST" action="offline.php3" enctype="multipart/form-data">
<input type="Hidden" name="send" value="1">
<input type="Hidden" name="action" value="batch">
<INPUT TYPE='hidden' name='MAX_FILE_SIZE' value='65000000'>
<p> Festplatte nach Datei a.dat durchsuchen
<input type="File" name="dat_file"></p><p><input type="submit"
value="Hochladen"></p>
My code for this: File dat_file = new File("a.dat"); MultipartPostMethod post2 = new MultipartPostMethod("http://www.besteauktion.de/offline.php3"); Header post_header1 = new Header("send","1"); Header post_header2 = new Header("action","batch"); Header post_header3 = new Header("MAX_FILE_SIZE","650000000"); post2.addRequestHeader(post_header1); post2.addRequestHeader(post_header2); post2.addRequestHeader(post_header3); post2.addParameter("dat_file",dat_file); statusCode = client.executeMethod(post2);
ciao Stefan:wq
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
