Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create unique file name?

I copy image files from one folder to another with help of File.Copy() method.

I need to give unique file name to the copied image file before it is pasted to the folder.

Any idea how I can implement this?

like image 753
Michael Avatar asked Dec 04 '22 02:12

Michael


1 Answers

You can use Path.GetTempFileName

more info at: http://msdn.microsoft.com/en-us/library/system.io.path.gettempfilename(v=vs.100).aspx

a quote from the link:

"Creates a uniquely named, zero-byte temporary file on disk and returns the full path of that file."

like image 127
eyossi Avatar answered Dec 31 '22 08:12

eyossi