Uploading large images using retrofit 2
See original GitHub issueIam using Retrofit 2.3.0 to upload images to a .Net framework server,
the uploading of images i working fine … ubt when i try to upload >5MB images it gives me an error
when i logged the request it doesn’t read the full file and gives EOF exception … and i do have to compress the image with about 50% quality which is not very good
iam using MultiPart
to upload and this is my code snippet
RequestBody requestFile =
RequestBody.create(MediaType.parse("image/jpeg"), file);
MultipartBody.Part body =
MultipartBody.Part.createFormData("image", file.getName(), requestFile);
// add another part within the multipart request
RequestBody fullName =
RequestBody.create(
MediaType.parse("multipart/form-data"), image.getDescription());
and this is the okHttp log
--------- beginning of main
10-30 14:25:45.330 11236-11402/com.project.peoject D/OkHttp: �Dwm�1l�n�D�RXZX�1[)$M��l�`��7Q���n�ӟ̊e�L،����=�k���*a�~�g��=�U�ɨ@<�x��/���>� ���R��@��z;c�?��Zʖ7��ۮ�0�*r����#ך�����3�J��F{���v� ��Kǩ�$||
read: unexpected EOF!
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:11 (1 by maintainers)
Top Results From Across the Web
Uploading large images using Retrofit 2 - Stack Overflow
I have solved this issue by compressing the image file using the Compressor library https://github.com/zetbaitsu/Compressor.
Read more >Retrofit 2 — How to Upload Files to Server - Future Studio
This tutorial will show you how to upload a file to a backend server using the second major release of Retrofit, namely Retrofit...
Read more >Upload file in Android Java with retrofit 2 | by Vo Thanh Tung
Upload file in Android Java with retrofit 2 · 1. Add retrofit 2 to gradle file (app level). · 2. Create Retrofit Instance...
Read more >Upload Files To Server Using Retrofit 2 In Android - C# Corner
Retrofit · Open Android Studio and Select Create a new project. · Name the project as your wish and select your activity template....
Read more >Let's Develop an Android App to Upload Files and Images
The users and creators must have the added functionality to upload images directly by accessing the phone storage. In this tutorial, we are...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@JakeWharton @Bhoomika06 I am facing same issue if i am sending files for more than 3 mb. Code is working fine for files size under 2 mb. Please help me out.
Hello Folk, I am facing the same problem while uploading video file (Size: around 6 MB) along with Image file. When I tried to sent only Video, Still got Same Error. If You can suggest anything to me; Please Give Suggestions.