zoranmil commented on issue #468:
URL: 
https://github.com/apache/cordova-plugin-file/issues/468#issuecomment-827523360


   solution for images  and videos
   copy to app cache dir 
    try {
                   InputStream in = 
FileHelper.getInputStreamFromUriString(uriString, cordova);
                     Path path = Paths.get(finalLocation);
                      Path fileName = path.getFileName();
                        OutputStream out = new 
FileOutputStream(getTempDirectoryPath()+ "/"+fileName.toString());
                
                byte[] buf = new byte[1024];
                int len; while ((len = in.read(buf)) > 0) out.write(buf, 0, 
len);
                in.close(); out.close();
                    this.callbackContext.success(getTempDirectoryPath()+ 
"/"+fileName.toString());
                  } catch (IOException e) {
                   ///finalLocation
                    this.callbackContext.success(fileLocation);
                 }
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to