You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2021/04/27 11:07:22 UTC

[GitHub] [cordova-plugin-file] zoranmil commented on issue #468: How will saving media files be handled in the new Scoped Storage paradigm being enforced by Android 11+?

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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org