0

I want to upload files on a web server in my android app.Currently i am able to upload files around 5mb from the device but more than this gives a outofmemory exception and also makes app very unstable.

i am looking for a method using which we can upload the data in the app background plus of bigger size. Any tutorials/ code is highly appreciated.

thanks in advance.

mudit
  • 25,306
  • 32
  • 90
  • 132
  • Hi mudit how to send an image to webserver having 2mb .can you send me some example code. I'm working in 2.3.3Api – Asish AP Jul 11 '11 at 06:11

2 Answers2

1

You probably want to check out this post from Fedor.

The main point is that you need to set on chunking.

e.g.

 connection.setChunkedStreamingMode(chunkSize); 
Community
  • 1
  • 1
ElDog
  • 1,277
  • 11
  • 19
0

This GitHub library could help : https://github.com/gotev/android-upload-service 2.3K stars Apr 2020

enter image description here

" -Easily upload files (Multipart/Binary/FTP out of the box) in the background with progress indication notification

-upload files to a server with FTP, HTTP multipart/form-data or binary requests

-handle multiple concurrent uploads in the background, even if the device is idle (Doze mode)

-automatically retry failed uploads, with a configurable exponential backoff possibility to automatically delete uploaded files when the upload is successful

Apps and libraries powered by this library-

-JIRA Cloud

-Quora

...

"

zennni
  • 1,397
  • 15
  • 12