- Gzip compresses only streams and doesn't maintain a directory of files. You could use "java.util.zip.*" or JTar to tar the files and then Gzip. Depends on what you have server-side.
- This should be restricted only by bandwidth.
- Restrictions might exist on server-side (php.ini e.g.), not for Android
- Multi-Part might be a way to solve your problem. But AFAIK there is no appropriate implementation for HttpURLConnection. And it's possible that your binary files "expand" the payload by beeing transformed to Base64 encoded, 7-Bit Strings (I'm not really sure about this point).
- I don't know. But a very important point here is that you should transfer the images in a background service, especially when you build big chunks of data. Even AsyncTask might fall short, because lifetime might be dependent on the activity and when uploading a large amout of data the activity could already be destroyed. Have a look at RoboSpice. If you don't use the library, at least copy the strategy they use. Personally, I'd begin with binary uploading image by image, each with a new HttpURLConnection. Android will maintain an open connection (keep-alive), the traffic can be binary and the only thing you lose is some time (latency). But this would be a lot easier to implement on client-side and probably on server-side, too.
How to zip multiple images and post to server using google recommended HTTPURLConnection? [closed]
-
22-07-2023 - |
Question
How to zip multiple images and post to server using google recommended HTTPURLConnection? For example 50 images available getExternalFilesDir(Environment.DIRECTORY_PICTURES) directory,
- Can I use Gzip to club and compress as a single file?
- How many images can i club in a single file?
- What is the maximum size of compressed file post to server using HTTPURLConnection?
- Can I use Multipart HTTP request to post the compressed file?
- Is it any best practice available in android to post multiple images to server?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow