1

I am building a site with D8, where I have a content type 'user' where among other fields, I have two 'file' fields where users will be uploading their CVs (one for english, one for greek language).

I have successfully used File (Field) Paths to give desired, certain filenames to each file, say 'username_EN.XXX and username_GR.XXX' .. This works ok.

My problem is that users will obviously be renewing their CVs, and whenever a new file is uploaded, its filename is automatically incremented to 'username_EN_0', 'username_EN_1' etc.

I need to have new files overwriting old ones and keeping the same filename.

I have researched a lot for this functionality, and it seems it's not yet standard for D8.

This issue presents a summary of this problem, and there are various patches and solutions offered, but it's ambiguous whether they do work, and/or whether they apply to specific scenarios. The issue is still open, and unassigned.

The module itself, has a very similar issue thread, with some solutions offered, but only for the 7.x branch. There is nothing similar for the 8.x version, and obviously no such functionality.

Other searches point to very old similar threads (from 8-9 years ago) like this one or module descriptions that never came to life.

I believe that this functionality must have been needed before, I thought there would be a simple way of solving this. Am I missing something?

Any help would be greatly appreciated ..

  • 1
    This issue might have some useful comments, drupal issues. Try to look at comment 13 or 15. – Jdrupal Apr 21 '18 at 11:37
  • thanks for the prompt reply. I 'm a bit new to Drupal - so basically create a custom module with this functionality? So create MODULENAME.info.yml and then MODULENAME.module with the above code? -EDIT- I see you edited the reply, but still, create .module with relevant code? – thomas Apr 21 '18 at 11:42
  • Yes excactly, and remember to enable the module and clear the cache. – Jdrupal Apr 21 '18 at 11:43
  • Alright, thanks a lot - I will try that and will mark correct answer accordingly. – thomas Apr 21 '18 at 11:44
  • However, I am a bit reluctant. I have read this thread (it's mentioned in my original post) and for example see comment #20: 'Sigh. Nevermind. Both ways opened too many holes.'... I have a dev environment, so I can test freely, but from the comments, it doesn't seem like any of the patches shown there offer a definite answer. I might be wrong though, I hope so :) – thomas Apr 21 '18 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.