简体   繁体   中英

saving file in Assets folder in Windows 8 App

I am developing an App for Windows Store. I have to save a recorded media as "file1.mp3" into the Assets folder without opening the save file prompt. I used the following code

StorageFile file = await Windows.ApplicationModel.Package.Current.InstalledLocation.CreateFileAsync(@"Assets\\file1.mp3",Windows.Storage.CreationCollisionOption.ReplaceExisting);

However the system returns an "access denied" error. The file has to be saved in the Assets directory only and I do not want to use FileSavePicker . Please Help.

Thanks

Your package folder is read-only. Use your app data folders from Windows.Storage.ApplicationData.Current instead, wherein you'll find a LocalFolder and TemporaryFolder (also RoamingFolder but an mp3 would exceed the 100KB roaming limit). Then you can use either folder's CreateFileAsync.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM