Jump to content

Setting to force file/image replacement without numbered suffix when MaxFiles set to 1


Recommended Posts

Hi Ryan,

I think the title is pretty self-explanatory, but I would like to see a setting, just below the MaxFiles field that would force a newly uploaded file/image with the same filename to replace the old one, rather than deleting the old one, but still adding a counter to the end of the filename for the new one. My reasoning is mostly for external sites linking in to these files. 

If an admin user wants to update a file with a newer version, the "1" etc will be appended and the external incoming link will no longer work.

I expect I could write/adapt the code you provided here: http://processwire.com/talk/topic/3299-ability-to-define-convention-for-image-and-file-upload-names/?p=32623

which I might end up doing, but I thought others might also find this useful in the core.


Link to comment
Share on other sites

Hi Martijn,

Afraid I am not really understanding your suggestion. What I am wanting to do is make sure that when an admin user uploads a new version of the same file (with the same filename) that PW doesn't append a '1' etc to the filename. I could tell the user to delete the file first, then save the page and it will work as I want, but I am trying to avoid them having to do that step.

It sounds like maybe you are talking about a front-end upload?

Link to comment
Share on other sites

I think I understand the request, but feel this probably belongs as a module since it such a specific need. My opinion has always been that the core should only have features that would be regularly used in at least 30% of installations. Otherwise we run the risk of having too much, over-configuration, etc. There are actually some modules we now have in the core that aren't used in at least 30% of installations (anyone ever used FieldtypeCache or some of the lesser known Textformatter modules we include?), so these will likely be moved out of the core in an upcoming version of PW. When it comes to meeting specific needs, I prefer to update the core to add new hooks where necessary (for modules) rather than adding new functionality or configuration. I think your case is one that does sound like a useful capability, but I'd prefer to assist you in implementing it as a module rather than adding it to the core. I'm sure some others will find it useful too, so would like to see it in the modules directory too. 

  • Like 4
Link to comment
Share on other sites

  • 11 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...