c# - UWP: Using Cloud image FilePath Access Denied -


i'm using file picker select image use in app. save filepath in other pages of app, display image filepath. when image on device, works. if image on cloud, file path:

"c:\data\users\defapps\appdata . . .\tempstate\sharecache\img_1613.jpg"

gives me error message access denied.

one solution can think of once image selected making copy of image device filepath accessible.

is best practice handle situation?

this code i'm using:

private async void addpic_onclick(object sender, routedeventargs e)     {         fileopenpicker openpicker = new fileopenpicker();         openpicker.viewmode = pickerviewmode.thumbnail;         openpicker.suggestedstartlocation = pickerlocationid.pictureslibrary;          openpicker.filetypefilter.clear();         openpicker.filetypefilter.add(".bmp");         openpicker.filetypefilter.add(".jpg");         openpicker.filetypefilter.add(".jpeg");         openpicker.filetypefilter.add(".png");          // launch file open picker , caller app suspended , may terminated         var file = await openpicker.picksinglefileasync();         if (file != null)         {             var loadimage = new bitmapimage();              using (var stream = await file.openreadasync())             {                 await loadimage.setsourceasync(stream);             }             img.source = loadimage;             _imagefilepath= file.path;          }     } 

according description, may using onedrive on pc/ phone.

"c:\data\users\defapps\appdata . . .\tempstate\sharecache\img_1613.jpg"

this system level folder storing cache file , shouldn’t/cannot access through file picker in app.

for scenario, 1 solution said, download image, or can develop app onedrive api, or more easier, if allow syncing files on device, can access microsoft onedrive folder file picker.


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -