In my page downloads, I have lot of liks for files to be downloaded bu the
HREF="download/file1.zip">Download without jspsmart
And then when the user download a file and update it, he will go back to a
page for uploading that file.
right now everything is working fine, BUT if TWO users downloads the same
file update it and then upload it, in this case the last upload will
overwrite the previous one.
Please could you help me to find out a solution for this problem.
i was going to say use some synchronized code, but i think you need to define some business rules about what exactly is supposed to happen. what's the exact procedure you are trying to accomplish? all i can tell is that you don't want a conflict if 2 people download and modify the same file, and upload it one after another effectively deleting the previous person's changes.
anyway, you can also use the java.io.File class of java to determine whether or not the file being uploaded already exists. if it does you can either rename the file that already exists on the server or change the name of the file that is being uploaded. so really, this is up to your business rules.