Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1053
  • 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
Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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