Solved

Java Multipart file upload

Posted on 2009-05-19
9
1,024 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

617 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