neerhajnjoshi
asked on
Java Multipart file upload
I am attempting to write a code which will upload a file in parts using a POST request. With every part, I need to send following lines in the POST body,
FILENAME: xxx
LENGTH: xxx
MD5: xxx
SESSIONID: xxx
PARTS:x
===PART:x===
<part of the file here>
===END:md5 checksum===
After sending a part, I have to wait for a 202 response and then send the next part.
Any ideas on how to do this?
FILENAME: xxx
LENGTH: xxx
MD5: xxx
SESSIONID: xxx
PARTS:x
===PART:x===
<part of the file here>
===END:md5 checksum===
After sending a part, I have to wait for a 202 response and then send the next part.
Any ideas on how to do this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@CEHJ,
how do I wait for a response before sending out next part ?
how do I wait for a response before sending out next part ?
what are you using to send the request? Once yo have sent the request you need to read the request (which will include the 202 response code which you need to read, don't just assume it there)
following shows how to send a post request
http://helpdesk.objects.com.au/java/how-do-i-send-a-post-request-using-java
http://helpdesk.objects.com.au/java/how-do-i-send-a-post-request-using-java
ASKER
I am aware how to send simple POST/GET requests. It would be great if anyone could post a sample of multipart post request.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
a. get that info before you construct the request and add it as post params
b. subclass the request itself