Uploading multiple images with volley?

Stella

I have gone through a lot of post in SO and other tuts as well.But i couldn't get any latest official or other post that doesn't contain any deprecated code for uploading multiple images using volley.I came to know Apache HTTP Client removal and related in new android M and preferred to use below instead.

android {
    useLibrary 'org.apache.http.legacy'
}  

So, can any one help me out for doing multiple image upload with new updated deprecated less volley class ?

Anoop M

You can use the latest version of volley from here.It's an unofficial mirror with some minor bug fix and the source code will synchronize periodically with the official volley repository.

for Gradle

compile 'com.mcxiaoke.volley:library:1.0.19' 

or you can download the compiled version from here

Now you can use the below attached class for making multipart request using volley by the help of MultipartEntityBuilder in org.apache.http.entity.mime without having any deprecated code.

CustomMultipartRequest.java

Sample usage

//Auth header
Map<String, String> mHeaderPart= new HashMap<>();
mHeaderPart.put("Content-type", "multipart/form-data;");
mHeaderPart.put("access_token", accessToken);

//File part
Map<String, File> mFilePartData= new HashMap<>();
mFilePartData.put("file", new File(mFilePath));
mFilePartData.put("file", new File(mFilePath));

//String part
Map<String, String> mStringPart= new HashMap<>();
mStringPart.put("profile_id","1");
mStringPart.put("imageType", "ProfileImage");

CustomMultipartRequest mCustomRequest = new CustomMultipartRequest(method, mContext, url, new Response.Listener<JSONObject>() {
            @Override
            public void onResponse(JSONObject jsonObject) {
                listener.onResponse(jsonObject);
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError volleyError) {
                listener.onErrorResponse(volleyError);
            }
        }, mFilePartData, mStringPart, mHeaderPart);

Either you can use httpmime-4.3.5.jar and httpcore-4.3.2.jar for getting access of MultipartEntityBuilder and other methods which is used to make the request or add the following in your gradle if your targeting API 23 and above.

android {
    useLibrary 'org.apache.http.legacy'
}  

Any way I'm using the mentioned jar's and it's works like a charm in Android M also.

Update

Please note, com.mcxiaoke.volley:library:1.0.19 deprecated and no longer being maintained, please use official version from jCenter.

compile 'com.android.volley:volley:1.0.0'

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Is Volley framework in Android is suitable for uploading images and videos?

From Dev

Uploading images to IMGUR using Volley returns TimeoutError

From Dev

Android: uploading user images to server (Volley/Blob)

From Dev

Uploading multiple images in codeigniter?

From Dev

Uploading multiple images with paperclip?

From Dev

Uploading multiple images with Django

From Dev

Uploading multiple images in codeigniter?

From Dev

Django multiple images not uploading

From Dev

Uploading Multiple Images using CarrierWave

From Dev

Multiple images rename & uploading in PHP

From Dev

Multiple images rename & uploading in PHP

From Dev

All images not uploading in multiple images upload

From Dev

Uploading multiple images from Share Extension

From Dev

Uploading multiple images with other parameters in Swift

From Dev

Django REST: Uploading and serializing multiple images

From Dev

Uploading multiple images to mysql database on Apache server

From Dev

PHP: Uploading multiple images to imgur at once

From Dev

multiple images uploading and converting them to thumbnails in cakephp

From Dev

PHP: Uploading multiple images at the same time

From Dev

Uploading multiple images in webservice using PHP

From Dev

Uploading multiple images using SRWebClient in Swift

From Dev

uploading/downloading multiple images the right way?

From Dev

Rails and carrierwave uploading multiple images fails

From Dev

filereader result order changing while uploading multiple images in javascript

From Dev

Issue uploading multiple images to a page with "upload" button...

From Dev

Uploading multiple images one to each row PHP and Mysqli db

From Dev

Jquery : Post Request is breaking while uploading multiple images

From Dev

Uploading multiple images on twitter using Ruby on Rails Twitter Gem

From Dev

Rails, uploading multiple images with carrierwave, but json not supported by my database

Related Related

  1. 1

    Is Volley framework in Android is suitable for uploading images and videos?

  2. 2

    Uploading images to IMGUR using Volley returns TimeoutError

  3. 3

    Android: uploading user images to server (Volley/Blob)

  4. 4

    Uploading multiple images in codeigniter?

  5. 5

    Uploading multiple images with paperclip?

  6. 6

    Uploading multiple images with Django

  7. 7

    Uploading multiple images in codeigniter?

  8. 8

    Django multiple images not uploading

  9. 9

    Uploading Multiple Images using CarrierWave

  10. 10

    Multiple images rename & uploading in PHP

  11. 11

    Multiple images rename & uploading in PHP

  12. 12

    All images not uploading in multiple images upload

  13. 13

    Uploading multiple images from Share Extension

  14. 14

    Uploading multiple images with other parameters in Swift

  15. 15

    Django REST: Uploading and serializing multiple images

  16. 16

    Uploading multiple images to mysql database on Apache server

  17. 17

    PHP: Uploading multiple images to imgur at once

  18. 18

    multiple images uploading and converting them to thumbnails in cakephp

  19. 19

    PHP: Uploading multiple images at the same time

  20. 20

    Uploading multiple images in webservice using PHP

  21. 21

    Uploading multiple images using SRWebClient in Swift

  22. 22

    uploading/downloading multiple images the right way?

  23. 23

    Rails and carrierwave uploading multiple images fails

  24. 24

    filereader result order changing while uploading multiple images in javascript

  25. 25

    Issue uploading multiple images to a page with "upload" button...

  26. 26

    Uploading multiple images one to each row PHP and Mysqli db

  27. 27

    Jquery : Post Request is breaking while uploading multiple images

  28. 28

    Uploading multiple images on twitter using Ruby on Rails Twitter Gem

  29. 29

    Rails, uploading multiple images with carrierwave, but json not supported by my database

HotTag

Archive