Jagooodek
Jagooodek

Reputation: 1

Where and how save temporary files in WPF C# app

I am building a wpf c # application, at user request I download image files from DB (not designed by me). Where should I save these files so that I can open them later in the program?

Upvotes: 0

Views: 1207

Answers (2)

Joe
Joe

Reputation: 6816

The simplest way is to just call Path.GetTempPath. This will give you a writable folder that is your temp folder. If you are looking for something specific like a windows Special folder then something like

Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)

(or some other SpecialFolder value will do.

Upvotes: 3

Palisar
Palisar

Reputation: 71

You can try adding a temp file like this:

string FileName = Path.GetTempFileName();
FileStream File_Stream = new FileStream(FileName, FileMode.Append, 
FileAccess.Write);
//Do what you like with this file 

Upvotes: 0

Related Questions