Last post Apr 20, 2008 06:02 AM by hs_jha
Apr 14, 2008 12:21 PM|hs_jha|LINK
How do i prevent name clash on server for uploaded jpg files (if i don't want to overwrite it)
trying to make a private photo gallery for members of a small social networking site.
what image naming policy should i follow for multiple pic upload from same member?
Thx in advance.
Apr 14, 2008 01:21 PM|ps2goat|LINK
You should not set the name of the file based on the user's file name. Instead, use a numbering system or GUIDs, since that will help promote uniqueness.
membername + _ + file# for this member: memName_4 or memName_5 or User44839_1
memberID + _ + file#: 232_2 or 99384_4
GUID (unique to the machine): something like AE78S0FF938A8D9D8G78D9.
You can use the database to store the filename to use. Store the user the image belongs to and the file name, as well as what the user originally called it if desired. Just don't put a unique constraint on the original file name, so that the user can have
multiple files with the same name (as well as multiple users having the same file name).
Apr 20, 2008 06:02 AM|hs_jha|LINK
Thx alot it worked. My Private photo gallery is ready now !