Questions tagged [multipartentity]

MultipartEntity is successor of HttpEntity, contained in HttpMime API since version 4.0. It's use is primary to simplify process of posting multipart content over HTTP. It allows to add multiple parts of different content-type and encoding.

MultipartEntity, part of HttpMime 4.0 and later. Allows you to put multiple parts, separated by boundary strings and encoded using given charset, into request.

It can have different modes, based on HttpMultipartMode constants. RFC Strict mode ( RFC 822, RFC 2045, RFC 2046 compliant ) and Browser compatible mode.

Each part of request is set via addPart(String name, ContentBody body) or addPart(FormBodyPart body) method.

Note that request, can have only one entity set, so all data must be fit in MultipartEntity object.

232 questions
2
votes
2 answers

How to upload image in Web Api using http client?

I want to send my file from android device to web api with the parameter of name, chunk, file data. I have this code: It doesn't return any error on me I don't know what I do wrong. Please help I'm spending much time with this and it still doesn't…
NewDroidDev
  • 1,656
  • 5
  • 19
  • 33
2
votes
2 answers

Converting com.google.api.services.drive.model.File to java.io.File

So I want to create a java.io.File so that I can use it to generate a multipart-form POST request. I have the file in the form of a com.google.api.services.drive.model.File so I'm wondering, is there a way I can convert this Google File to a Java…
2
votes
0 answers

Why files are treated as directories?

When I am adding 2 files to multipartentity I recieve: 07-03 11:37:22.465: W/System.err(1112): java.io.FileNotFoundException: /: open failed: EISDIR (Is a directory) I read, it might happen if i have directories with same name, but that's not…
Yarh
  • 4,459
  • 5
  • 45
  • 95
2
votes
2 answers

Android HttpClient Post File MultipartEntity

I am trying to upload an image from an Adroid app to a php webserver using HttpClient and MultipartEntity. Here is a snippet of my code : protected Void doInBackground(Void... params) { HttpClient client = new DefaultHttpClient(); …
user2478861
  • 63
  • 2
  • 5
2
votes
1 answer

Android HttpClient: sending a post request with MultipartEntity or Entity

Basing on this response I have learnt which I must use MultipartEntity in order to send an http post request with a body and parameters. What I don't know is: once the request arrives on server side, does it have to manage in a different way the…
Massimo
  • 3,436
  • 4
  • 40
  • 68
2
votes
1 answer

How do I add an Instance of a class I created to a MultipartEntity?

So I have a class Workout that I created and I would like to send it to a server using HttpPost. Is there a way I could add that class to a MultipartEntity or how should I post it?
Amre
  • 1,630
  • 8
  • 29
  • 41
2
votes
0 answers

send multipart entity data from iphone

I use following code to send Multipart Entity data to server and server give me 403 response everytime. NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; [request setURL:[NSURL…
Hardik Joshi
  • 9,477
  • 12
  • 61
  • 113
2
votes
1 answer

How to zip/compress the Multipart HTTP request sent by the client

I am using apache httpclient 4.2 to send Multipart HTTP PUT request. The client has to upload large size binary data of the order of 500 MB. Hence compression is required. I wish to compress the whole Multipart HTTP request and inform the server…
UniLocal
  • 79
  • 12
1
vote
1 answer

Unit Testing for MultiPartEntityBuilder fails with org.apache.http.ContentTooLongException: Content length is unknown

I have a class in my javax servlet application that serves as a proxy and creates multipart form data for POST requests. During regression tests (actual calls to the servlet) the application performs as expected, however, my unit test continues to…
E_R
  • 33
  • 6
1
vote
1 answer

Converting input stream containing multipart form data to string in java

I have http response object "httpResponse" which is instance of class javax.ws.rs.core.Response. I have to convert it into a human readable string object for debugging. How can I achieve this? final InputStream inputStream = (InputStream)…
Zack
  • 2,078
  • 10
  • 33
  • 58
1
vote
1 answer

In Android Does multipart entity is used for download file too as I can't see any example or details description for that class

I was asked to look for downloading file using MultiPartEntity in android However i searched a lot but couldn't find any solution where I can download file using MultiPartEntity. it seems it is used to upload files only. I couldn't find detail…
Tarun
  • 1,192
  • 2
  • 11
  • 20
1
vote
0 answers

Sending a file and a string using MultiPartEntity in Android to server

I have an Android app from which I can select a video and select an option from a drop down. I want to send both of these to the server for analysis and get back the results. This is the code. Android app MultiPartEntity entity = new…
Keerthan Bhat
  • 314
  • 2
  • 15
1
vote
2 answers

Exception in executing httpclient with PUT request

I have to upload (PUT) a multipart data which includes a PDF/JSON file, some metadata and a header with authorization, but an exception occurs. I am newbie with multipart data and android, so if anyone can point out, where am I going wrong. private…
1
vote
1 answer

Unable to upload image first time, it works in the second time

I am uploading any type of file from my code but the problem is when I run my code for the first time and try to upload an image, the image not being uploaded in that time. If I upload a file first, e.g. a PDF file, it is being uploaded successfully…
mishti
  • 183
  • 7
  • 20
1
vote
0 answers

Upload file from MultipartEntityBuilder, added headers in file

I upload a JSON file using MultipartEntityBuilder. on another side when I read the file some headers are added on both top and bottom of the file. I tried many things to remove headers from a file but no success. here is the code how I write…
sadia
  • 305
  • 1
  • 7
  • 18