[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1099
  • Last Modified:

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?
0
neerhajnjoshi
Asked:
neerhajnjoshi
  • 4
  • 2
  • 2
3 Solutions
 
CEHJCommented:
Two ways basically:

a. get that info before you construct the request and add it as post params
b. subclass the request itself
0
 
CEHJCommented:
(Your can use Apache HttpClient's multipart)
0
 
objectsCommented:
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
neerhajnjoshiAuthor Commented:
@CEHJ,

how do I wait for a response before sending out next part ?
0
 
objectsCommented:
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)
0
 
objectsCommented:
0
 
neerhajnjoshiAuthor Commented:
I am aware how to send simple POST/GET requests.  It would be great if anyone could post a sample of multipart post request.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 4
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now