Click here to Skip to main content
15,878,959 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Is it possible to upload image with same name in a image folder , if possible then how in asp.net.........
Posted

Before saving the file in server, append a GUID to the file name so that image names will always be unique.If you use same name i guess it'll overwritten the other file with the same name.
 
Share this answer
 
Comments
aryan2010 11-Jun-10 7:30am    
Can u explainhow to append a GUID to the file name before storing the file in server......
there is no change in the rule even it is in asp.net , as far as i concern it doesn't allow to store two files with the same name, and GAC is the only place where you can store two files with the same name but different version numbers.
 
Share this answer
 
A file system is a file system. A GUID is a string, another easier way is to use a loop to search for the filename with a number appended until the file does not exist. Of course, if you want to show the original filename in your UI, you need some metadata that tells you the filename to show, as opposed to the filename you had to use.
 
Share this answer
 
It depends on how you're uploading it.

If it's via windows sockets or the query string, you have to write code that will open the file in such a was as to overwrite the file if it already exists.

If you're doing it via FTP, (I think) you have to delete the file on the remote machine (again, via a FTP command) before uploading it. It's been a long time since I did any FTP stuff, so you may be able to specify that existing files are overwritten when they're uploaded.
 
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