I need to make app to upload and download files
when user upload for example "file.mp4" if this size more then 1MB i will Split it or Chunked it to Simmler files in like [500kb , 500kb] and upload first 500kb in server and secound 500kb to scound server then when will download this files again i need to integrate [500kb + 500kb] = 1MB
and show file 1MB like first time
It seems as though you've already stated a method to approach your particular problem. Here is a link to another question that is somewhat related. Learning the buffer process and how to implement it would be a start.
Hope that's useful.
Related
I want to upload all files of a folder to my PHP page.
That is, If I have several images inside a folder, and I want to upload (HTTP POST) all pictures in the folder to my PHP page, which then gets saved in my web directory by their respective file names.
How can I do that? I know about AsyncTask, but I am beginner in Android programming.
I don't know how to make array or list or loops.
AsyncTask is way too older, I am not saying we should not implement but has to take care of a lot of things if implemented!
Rather go with implementing RxJava based implementation but again since you are new to the android programming, so I would not suggest!
Since you are new to the android programming so we can say it's a long problem to solve. I would suggest you go steps wise steps. Let me give you pointers you would be searching, exploring and building around:
Find the directory in folders and iterate through each files to prepare a list
Two popular ways of uploading images: 1) Convert into Base64 and upload one by one 2) Multipart image upload
Instead of AsyncTask, you may use Retrofit Multipart image upload
I'm wondering what the best way to share multiple images and text in one-go. The text belongs to the images as descriptions
I have researched some and you can convert images to binary, place them in a json file and open certain files with your app, read the text and convert the binary back to bitmaps.
However this requires you to send a file with multiple binary images, which can grow a bit big. It is also cpu intensive
I was thinking of sharing these files over e-mail or whatsapp, but my question is: Is there any better way to do this?
The easiest thing you can do is to let the user share the file using an application of their choice, just like you said.
Other possible solutions are:
Upload the file to your own server and let it expire after some time.
Use a file sharing service API
However these will take more time to implement and most of them might cost you money.
I need to develop an offline application in which it has got around 700 images, around 100 videos, 100 pdf's need to be included along with apk.Currently i have put images in drawable folder,videos in raw folder, and pdf in asset folder.When i build the application including all this apk size goes upto 1.5gb.My question is
1.Is it appropriate to include images and video in res folder?Is there any other method to handle this situation
3.One peculiar error will get generated when you build the app that is "package r does not exist android studio".Even though apk gets generated,studio shows this error
It's best to make use of Google Play APK Expansion Library for handling large application data. Imagine having the user download/install a single 1.5GB APK file.
Possible reason: R is re-generated by your environment everytime you add a new resource, as you are using a lot of files this may take time and during the process you will get the error R doesn't exist
Best way would be if you keep the app light without images and videos, only download the files from the server after the user installs the app, on a per need basis. You can save these in the SD card and save users on phone storage space as well.
First of all, if there's gonna be so much data then it should not be in stored in the App (APK). Also google doesn't allow this big APK to be uploaded at once, the big apps are divided into parts. You must have seen for the big games it first downloads a game, it starts and then downloads big amount of data later. But in your case I think the standard way to handle this situation would be to keep all this data on the server and whenever you need it just request it from there.
The best suited for this is to use "facebook conceal"
I need to download large audio files from a web server from within a corona sdk app, and have been looking at using network.download() or possibly network.request() for this purpose.
Because much of the user base will be in areas that have poor or intermittent network coverage, I would like to improve robustness of the download process by allowing for resuming download from where it left off if the network drops out.
From the documentation neither network.download or network.request functions seem to support this directly, but is there a way that I can use either of these functions to achieve what I'm looking for? If not, is there another technique I can use?
My app will eventually be for both iOS and Android, but for now I am developing the iOS version first. Therefore, I am ok with having to use a different solution for each platform if there is not an easy solution that covers both platforms. However, I would prefer not to have to use native code if possible as I don't currently have an Enterprise subscription for Corona.
I don't think you can do this using Corona without native plugins.
One way to go around this problem is to split the large files in smaller ones, and I don't mean creating multiple audio files just splitting the large audio files in smaller files.
Then you can download one chunk at a time and when one fails, by getting an error in the handler or waiting a reasonable timeout and then checking to see if the file is present in the file system, you can start downloading it again.
After all chunks are download you can recreate the large file by using the ltn library.
You can read some more about the ltn12 library here and I think you need to take a close look to the Pumps method.
On your server-side, create a simple program that splits an audio file in multiple sub-files of the max size you would like to specify.
On your client-side, create a function that collides multiple chunks in one single audio files.
For example if you would like to limit your file size to 1MB, create a server side program that splits any audio file above 1MB in chunks: a 4.5MB file would be split in part1 1MB, part2 1MB, part3 1MB, part4 1MB, part5 0.5MB.
Glue the chunks together in one single file in your lua code when you have fetched that with network.request.
I need a fast way to upload files to a ftp server.The files will be used for a primitive chat.Something like a timer and every 5 sec checks to see if the file x was added,if it was added open it and show it.
So please tell me an easy way to upload a file,because from google,I got only hundreds of lines of code.And yes,I need it for a FTP server.
Also it would be awesome to tell me a way to acces a file trough ftp open it and show it.(don't really need to download).
You should use the org.apache.commons.net.ftp.FTPClient library - it's free and implements fairly easily with Android. You can find a pretty easy how-to at the bottom of this blog post:
http://hoang17.com/posts/android/android-how-to-upload-a-file-via-ftp
That article should be especially helpful as it shows you how to store a string as data in a specific filename.
To be honest though - FTP seems like the absolute worst way to create any form of chat communication. :)
Cheers.