Skip to content
Advertisement

Possible to determine size of file to be downloaded?

I currently have the following code which reads a file located on the web and writes it to a file on the phone:

JavaScript

Does anyone know whether it is possible (using the setup above or otherwise) to determine the total number of bytes which are to be read before commencing with the download (in order to publish percentage progress to the user as the download proceeds)?

Advertisement

Answer

use the getContentLength method of URLConnection

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement