pyrocms/pyrocms — pull request #2000 by marcogrueter (2012-11-12 11:52:43+00:00)
Title: Replace file in File Module Backend, related to Issue/Feature Request #1567

Since one of my customers urgently needed this functionality, I gave it a try.
Target was to be able to replace images without losing keywords, description or the filename of the old file.

Biggest problem is the filename, especially the extension, since I wanted to preserve the filename in any case. I "solved" it by adding a warning to the upload dialog, something like "do not replace a file with a file of a different type/extension".
A bit cheap, but I couldn't come up with a better solution to prevent showing/downloading PNGs with JPG extension.

Second thing I'm not that happy with, is the addition of a file upload counter in the fileupload-UI script to prevent upload more than 1 file when replacing an image.
But since I was in a hurry and couldn't come up with a different but equally easy solution... well maybe one of you guys has a good idea.

I don't have access to a cloud thingy, so I couldn't test S3 or whatever. But it should work anyway, since I used existing functions where ever I could.

Maybe you could use this as a starting point for a better solution...
I just had a bit over 2 hours time for dev and testing, so it might not be perfect. But works for me so far.