Solved

Java Multipart file upload

Posted on 2009-05-19
9
996 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
  • 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
mockito example issue 8 72
ForLoop Example 3 48
expectj telnet failing 5 36
Desingning Refactoring existing code 2 24
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

770 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