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
0
votes
2 answers

File upload using MultipartEntityBuilder gives an Error

In my android app I'm using AsyncTask to upload a file to the backend. In there I use MultipartEntityBuilder in my doInBackground method. my doInBackground part is as follows, @Override protected String doInBackground(String... params) { try…
Samantha Withanage
  • 3,811
  • 10
  • 30
  • 59
0
votes
1 answer

Android Json Parsing with multipartEntity

I need to parse this as an JsonArray instead of objects but it dosent seem to work correctly. my output is ["{"TransactionVolume":"34","TransactionitemID":"2"}"] I need it to be [{"TransactionVolume":"34","TransactionitemID":"2"}] this is part of…
Jack
  • 69
  • 1
  • 2
  • 8
0
votes
1 answer

ExceptionInInitializerError in org.apache.http.entity.mime.MultipartEntity

I am trying to use the org.apache.httpcomponents:httpmime:4.5.2 dependency on Android but get this exception: E/AndroidRuntime: FATAL EXCEPTION: SyncAdapterThread-1 java.lang.ExceptionInInitializerError at…
user3352488
  • 281
  • 3
  • 15
0
votes
0 answers

How to add a pdf using MultipartEntityBuilder

I am trying to upload a pdf and image to a server. I am able to upload the image successfully. I am using the same code for pdf as it says to add only file no type : MultipartEntityBuilder builder = MultipartEntityBuilder.create(); …
Parth Anjaria
  • 3,961
  • 3
  • 30
  • 62
0
votes
0 answers

Android MultipartEntity.getContentType().getName() and MultipartEntity.getContentType().getValue() methods not found

I have an issue while using multipart to upload post data to server. HttpURLConnection conn = (HttpURLConnection)…
0
votes
1 answer

Sending String and Image to PHP script from android

Im using this code to make multipart entity and send String and Image to a PHP page - HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost(URL); MultipartEntityBuilder entityBuilder =…
Adrian
  • 1,677
  • 2
  • 12
  • 12
0
votes
1 answer

500 Internal server error when using multipart

Am really stuck with this issue for past several days. What I need to achieve is to send a image to server through Multipart. I tried this code but at server its says The request is not a Multipart request This is how I tried to send image to…
suja
  • 1,198
  • 2
  • 12
  • 32
0
votes
0 answers

400 Bad request after adding parameter

Am getting 400 Bad Request in Retrofit error after adding parameter to my request method @GET("/api/add/remark") void addRemark(@Header("Cookies") HttpCookie cookie, @Query("tenantId") long tenantId, @Query("userId") long userId, @Query("comment")…
suja
  • 1,198
  • 2
  • 12
  • 32
0
votes
0 answers

Java MultiPart post to C# side

I will be using the following Android Java code to upload an image to C# server API: HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(FILE_UPLOAD_URL); AndroidMultiPartEntity entity = new…
Yomash
  • 25
  • 4
0
votes
1 answer

How can response files from server

I am sending files(images , pdfs , ...) from android phone to server which is a servlet I am using the HttpClient and HttpPost . (multipart data) Here is my code for sending the post request String postURL = //server url; HttpClient httpClient =…
Habib Zare
  • 1,206
  • 8
  • 17
0
votes
0 answers

How to send Emoji Icons on php server with Multipart Entity

I am working on a project in which I am using this library https://github.com/ankushsachdeva/emojicon. I am able to see the Emoji Keyboard but when I am sending the text from Editext which contains Emoji Icons they are converted into ?? After some…
Prithniraj Nicyone
  • 5,021
  • 13
  • 52
  • 78
0
votes
0 answers

How to replace MultipartEntity and FileBody in HttpURLConnection (without server side modification)

I want to send *.log file to server. Before, I used apache lib to send *.log file,my code like: FileBody cont = new FileBody(file); MultipartEntity reqEntity = new MultipartEntity(); reqEntity.addPart("log", cont); reqEntity.addPart("log_name",…
TBL
  • 1
  • 1
0
votes
0 answers

MultipartEntity addPart() method is not working

I have used this before to send data to server in eclipse. now I'm using the same thing in Android Studio but it's showing Exception. in this line. entity.addPart("product_id",new StringBody("Id",new StringBody("12"))); I know, I should use volley…
Pre_hacker
  • 1,352
  • 1
  • 17
  • 21
0
votes
0 answers

Android: MultipartEntity addpart Double

Is there a way to send a Double value as part of an MultiPartEntity? I have captured a user's location as latitude and longitude which are Double values. Am not sure how to send these through an addpart. Or is this something that needs to be handled…
srinij
  • 471
  • 6
  • 10
0
votes
1 answer

Android - Post image within json object to server using volley library

I want post json object included image to my server using Volley Library it post empty fields to server , image file posted successfully I should post Json in this formate { "user_id":"value" ,…
Mina Fawzy
  • 20,852
  • 17
  • 133
  • 156