Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Temporary files in .Net

I need to create some bitmaps and save them to the file system. For some reason the MScharting system wants it's background files supplies as paths in string form.

I'm dynamically creating the background image, although only a few times.

What's the best way to create these files and then clean them up?

like image 258
Joel Barsotti Avatar asked Sep 23 '09 22:09

Joel Barsotti


1 Answers

Here's how you can get the full path and file name of a temporary file:

string tempFile = System.IO.Path.GetTempFileName();

Create the file using this filename & path and when you're done delete it.

like image 125
Jay Riggs Avatar answered Oct 17 '22 07:10

Jay Riggs