commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bachem <ste...@stefanbachem.de>
Subject File Upload via Post
Date Sun, 15 Feb 2004 07:51:57 GMT
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>&nbsp;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: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message