How to Save File to Isolated Storage in Windows Phone 8?

This content was proof-read by Grammarly. You can Try Grammary for FREE

There are times when you want to copy the files to isolated storage in your Windows Phone 8 App which you can do it easily using C#.

Below is a sample code snippet that demonstrates the copying of file to isolated storage in Windows Phone 8 using C#?

Are you a .NET Developer planning to integrate GraphQL for .NET in your Application? Check out this book BUY & DOWNLOAD GRAPHQL.NET COOKBOOK

How to Save File to Isolated Storage in Windows Phone 8?

private static void SaveFileToIsolatedStorage(Uri fileUri,string _fileName)


var AppIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication();

var FileName = AppIsolatedStorage.CreateFile(_fileName);

var FileData = Application.GetResourceStream(fileUri);

byte[] bytes = new byte[4096];

int Count;

while ((Count = FileData.Stream.Read(bytes, 0, 4096)) > 0)


FileName.Write(bytes, 0, Count);




Calling the function

Uri songUri = new Uri("test.mp3", UriKind.RelativeOrAbsolute);

SaveFileToIsolatedStorage(songUri, "test.mp3");

Note: make sure that test.mp3’s build action is set to “Content” and the “Copy to Output Directory” is set to “Copy Always”.

%d bloggers like this: