|
-
Apr 15th, 2010, 06:33 AM
#4
Re: Generate image path from unique name, what to do with invalid chars?
 Originally Posted by aashish_9601
you can asign an unique id to the radio station and use that id as the image name
I thought of that but that is not an option, for other reasons. Perhaps as a last resort.
 Originally Posted by danasegarane
You have this kind of options. You can go for the
Code:
Path.GetTempFileName()
Creates a uniquely named, zero-byte temporary file on disk and returns the full path of that file.
Code:
System.Guid.NewGuid
to get a unique GUID
Or You can use the current time(with seconds) with that RadioButton to create unique id
Code:
System.DateTime.Now.ToString("ddMMyyyhhmmss")
The GetTempFileName creates a filename in the Temp folder, right? I don't want that. I suppose I could always use only the last part of the path (the actual filename), but that would leave me with the same problem I think. I suppose the GetTempFileName generates a unique name in the Temp folder, which doesn't have to be unique in my own folder. So if I take this route I may as well just generate my own random name and hope I never get a conflict.
I'll look into the Guid thing, never used that before.
The time is not an option, because the custom stations are all saved in one go, along with their images, so the images would all have the same timestamp.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|