Solved

Java Multipart file upload

Posted on 2009-05-19
9
1,014 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
Technology Partners: 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Suggested Courses

710 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