scm0sml
asked on
using a new guid as a file name
Hi,
Users can upload images onto my site.
However I want to rename them and give them a random name.
I wanted to create a guid that would be used as the filename.
Something like:
Dim file As String = newFileName.ToString & "." & file_ext
but when i create the file with that the name is:
00000000-0000-0000-0000-00 0000000000 .JPG
any ideas?
Users can upload images onto my site.
However I want to rename them and give them a random name.
I wanted to create a guid that would be used as the filename.
Something like:
Dim file As String = newFileName.ToString & "." & file_ext
but when i create the file with that the name is:
00000000-0000-0000-0000-00
any ideas?
indeed there is a ready-made method like:
Dim fn as String = System.IO.Path.GetTempFile Name()
Dim fn as String = System.IO.Path.GetTempFile
ASKER
i cant guarentee that being unique tho can i?
- Dim fn as String = System.IO.Path.GetTempFile Name()
gemailj: is that c#? im using vb.net
- Dim fn as String = System.IO.Path.GetTempFile
gemailj: is that c#? im using vb.net
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Guid newFileName = Guid.NewGuid(); //this create a new rondom Guid
instead of
Guid newFileName = new Guid(); //this create a zero guid doesn't calulate it
Open in new window