I come to you today because i don't know how to copy an image from asset to localstorage. I try a something like :
StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(
new Uri("appx:///Assets/image.png"));
await file.CopyAsync(ApplicationData.Current.LocalFolder, "image.png");
But it doesn't work at all. Does anyone have an idea to do this right ? Thanks for your time, Regards.
Your Uri scheme is invalid. It should be ms-appx:
, not appx:
:
StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(
new Uri("ms-appx:///Assets/image.png"));
await file.CopyAsync(ApplicationData.Current.LocalFolder, "image.png");
See this post for valid Uri schemes: URI schemes supported in Windows 8 apps
Refer this link
Download an image to local storage in Metro style apps
Also
How ro store image locally once it was downloaded by Image control in Windows 8?
Might be helpful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With