We would like to create a small document management system in our C# application. It should be possible to download a file, edit it and then upload it again. The whole thing is represented in a grid like this:
Filename | Checked out by |
FileAbc | userXY23423423 | download | upload
FileDek | userdMd8765655 | download | upload
FileGHI | userhW45389459 | download | upload
Now the downloaded file should be able to be identified when uploading, e. g. with a hash which is stored in the database. This is to make sure that not another file is accidently overwritten.
Use Cases:
-A user can upload a file with <input type="file" name="file" />
.
-The File is listed in a grid list like above.
-So another User should now be able to download FileAbc, modify it and upload it again. The original file on the server should now be overwritten by the modified uploaded file.
Now our problem is the same as how to find out the original file from a file upload?
We tried the creation date of a file first. This will change every time you download the file.
Then we found a properties list for files: FileAttributes Enumeration. Unfortunately, we can't write a custom attribute value with a GUID or something like that in it.
This makes the only option currently available to store the GUID in the file name. However, we would like to avoid this since the users can get that as strange and delete it during the upload.
My current code is just a common upload/download function like this File Upload. I don't expect any final solution but really appreciate a good hint.