Hi,
i have found the way to post a form-data to my web server ( + Coldfusion).
But i don't know how to send a file (*.doc or *.zip) with that form-data? like an upload from a web browser.
this is my source code.
-----------------
sb.append( URLEncoder.encode("Name") + "=" );
sb.append( URLEncoder.encode("Jacquis") );
sb.append( "&" + URLEncoder.encode("UploadFile") + "=" );
for (int i=0; i < fileBuff.length; i++)
{
sb.append(fileBuff[i]);
}
String formData = sb.toString();
URL url = new URL("http://myIISServer/index.cfm");
HttpURLConnection urlcon = (HttpURLConnection)url.openConnection();
urlcon.setRequestMethod("POST");
urlcon.setRequestProperty("ENCTYPE","multipart/form-data");
urlcon.setRequestProperty("Content-type","application/x-www-form-urlencoded");
urlcon.setDoOutput(true);
urlcon.setDoInput(true);
PrintWriter pout = new PrintWriter( new OutputStreamWriter(
urlcon.getOutputStream( ), "8859_1"), true );
pout.print( formData );
pout.flush( );
----------------------
i received all but the upload file is not identified by my server side application.
------------------