Solved

Java Multipart file upload

Posted on 2009-05-19
9
1,006 Views
Last Modified: 2012-06-27
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
Comment
Question by:neerhajnjoshi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
9 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 24419780
Two ways basically:

a. get that info before you construct the request and add it as post params
b. subclass the request itself
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 168 total points
ID: 24419787
(Your can use Apache HttpClient's multipart)
0
 
LVL 92

Assisted Solution

by:objects
objects earned 332 total points
ID: 24419904
0
Independent Software Vendors: 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!

 

Author Comment

by:neerhajnjoshi
ID: 24420014
@CEHJ,

how do I wait for a response before sending out next part ?
0
 
LVL 92

Expert Comment

by:objects
ID: 24420031
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
 
LVL 92

Expert Comment

by:objects
ID: 24420040
0
 

Author Comment

by:neerhajnjoshi
ID: 24420585
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
 
LVL 92

Assisted Solution

by:objects
objects earned 332 total points
ID: 24420617
0

Featured Post

Independent Software Vendors: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
A few customers have recently asked my thoughts on Password Managers.  As Security is a big part of our industry I was initially very hesitant and sceptical about giving a program all of my secret passwords.  But as I was getting asked about them mo…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question