Click here to Skip to main content
15,886,840 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want a file upload control in my page in which when a person upload a image than it will go to image folder in root directory, my question is that when a person upload a image with name like arpit.jpg, and after some time another person will upload a image with same name then how we can differenciate between these two images which are uploaded with same name.
Posted
Updated 16-Nov-14 3:24am
v2

You need to consider some kind of convention. For e.g. add a prefix/suffix with a datetime stamp, the name of the user who uploaded the file etc.

Look at the link below on how to do that:

http://stackoverflow.com/questions/2621535/how-to-change-fileupload-name[^]
 
Share this answer
 
The same way you would do it for any other system:
1) Attach a version number before the file extension (if it's the same user)
2) Store it in a different folder (if it's a different user) so users only see their own files.
3) Store it using a temporary file name, and use a database to cross-correlate the temporary name to the "real" name.

I use both the first and last methods with GUID values as the stored file name and a simple SQL Table using the GUID as the row index.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900