Wednesday, 18 September 2013

Can I replace existing image in a same folder?

Can I replace existing image in a same folder?

I have developing a metro app, I have a page that save user selected
image. The thing is when I choose the image in the pictures folder error
will occur "Error HRESULT E_FAIL has been returned from a call to a COM
component" but if I choose from other folder it will proceed smoothly and
save the image name into the database. Here is the snippet:
if (file != null)
{
StorageFolder documentsFolder =
KnownFolders.PicturesLibrary;
output = await file.CopyAsync(documentsFolder,
file.Name.ToString(),
NameCollisionOption.ReplaceExisting);
}

No comments:

Post a Comment