Click here to Skip to main content
15,663,557 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
I want to upload and download files with same names but different content, but I want to do this without using GUID because it will increase my complexity.
So, is there any way of doing this without using GUIDs.
Updated 17-Jun-14 10:48am
Kyle Moyer 17-Jun-14 16:41pm    
Timestamps are always good. Just make sure you use a high enough precision to prevent duplicates. Seconds should usually be good enough, but as you haven't described what you're actually doing, milliseconds may be necessary. If milliseconds aren't good enough, you may want to reevaluate your design.
ZurdoDev 17-Jun-14 16:47pm    
You need something to keep them separate. Use whatever works for you.
Sergey Alexandrovich Kryukov 17-Jun-14 19:06pm    
Best answer so far. This is so artificial problem...
PIEBALDconsult 17-Jun-14 16:55pm    
"I want to do this without using GUID because it will increase my complexity"

Why would you want to increase your complexity?
Sergey Alexandrovich Kryukov 17-Jun-14 19:05pm    
:-) :-)

1 solution

one solution could be using Datetime stamp(with your desired datetime format) in the file name like :
test201406170449.txt ; test201406170450.txt ;test201406170451.txt ; ...

another one could be using numbers at the end of the filename for example:
test.txt ; test1.txt ;test2.txt ; ...

But if you want to keep only changed ones you'd better use file's lastupdateDate property in order to check if the file has been changed since the last upload or download.

FileInfo fi = new FileInfo("FilePath");
        DateTime lastUpdateDate = fi.LastWriteTime;
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