Sending multipart form in android by HttpURLConnection (POST)?

If someone will look for answer here is it how I made it.

If someone will look for answer here is it how I made it: private byte generatePhotoRequest(byte imagedata){ byte requestData = null; ByteArrayOutputStream bufer = new ByteArrayOutputStream(); DataOutputStream dataOut = new DataOutputStream(bufer); try{ dataOut. WriteBytes("--"); dataOut. WriteBytes(BOUNDARY); dataOut.

WriteBytes("\r\n"); dataOut. WriteBytes("Content-Disposition: form-data; name=\"auth\"; filename=\"auth\"\r\n"); dataOut. WriteBytes("Content-Type: text/xml; charset=utf-8\r\n"); dataOut.

WriteBytes("\r\n"); dataOut. Write(generateAuth()); dataOut. WriteBytes("\r\n--" + BOUNDARY + "\r\n"); dataOut.

WriteBytes("Content-Disposition: form-data; name=\""+CIMAGE+"\"; filename=\""+CIMAGE+"\"\r\n"); dataOut. WriteBytes("Content-Type: "+IMAGE_PNG+"\r\n"); dataOut. WriteBytes("\r\n"); bufer.

Write(imagedata); dataOut. WriteBytes("\r\n"); dataOut. WriteBytes("\r\n--" + BOUNDARY + "--\r\n"); requestData = bufer.toByteArray(); } catch(IOException ex){ ex.printStackTrace(); } finally{ if(bufer!

=null){ try { bufer.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } return requestData; }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions