First file was replaced with the second file in the DataObject and filesystem
Two File objects are created but only one file in the assets folder.
Delete one File object, then the other File object still exists but has no file in the assets folder.
First file was replaced with the second file in the DataObject and filesystem.
UploadTest passes with 0 failures.
I commented on your forum post, but for ease of discussion let's move it onto github. My message below:
Aha, this makes more sense to me now.
From what I can see, it seems that you should be getting a file exists warning on the frontend, asking you to proceed with the upload (and overwrite) or cancel.
I think what's wrong is that this dialogue doesn't work outside of the CMS, and is acting as though overwrite was always selected. This is obviously a problem, since we really want this field to work well in both the front and the back end.
For the mean time, just set setOverwriteWarning to false in your UploadField construction chain. This is probably the broken dialogue which is causing you trouble. Let me know if this solves your issue...
I'll do a bit of testing on the field tomorrow (probably, don't hold me to that) to see if I can come up with a better solution.
Some of the issues you noted above SHOULD be fixed with #2922, but I'll get onto this with my continued testing.
I believe all described results above had the same cause, which was fixed with #2922 I believe this issue can be closed as well.
perhaps 1 good point is creating more unit tests to catch such wrong results in future.
I still like to see an option to globally set the UploadField to not to overwrite files. Webspace is not an issue, but malicious overwriting of files from other users is.
good point. I agree, completely disabling the overwrite feature should be possible, both on a per field base as well as on a global scope.
You can still disable overwriting by setting the overwriteWarning to false on your UploadField. That way the global default stays untouched. It's a global default, not a global override... but if you want to make the behaviour to respect the defaults in UploadField, then check out my suggestion at #2920 (comment) and tell me if this is what you agree would work.
Fixed in #3048