1

I am facing a strange issue with a managed_file field in my Drupal form API. Whenever I upload a file and save the form, and then come back again to upload another file with the same name, I get this error message.

The specified file xyz.png could not be uploaded. The file temporary://xyz.png already exists. Enter a unique file URI.

However, if I try to upload the file again, it gets uploaded successfully with the file name renamed.

I noticed a similar issue reported in the module issue queue.

Can anyone suggest why this might be happening and how to fix it?

3
  • I think you indicated that you have a custom code implementation. If you do we need to see that in order to answer your question.
    – mona lisa
    Commented Mar 31, 2023 at 12:39
  • Added my code here - github.com/zuhairkareem/form_api-test , this is multistep form, step 1 there is managed_file, file stored in temporary folder, Step2 - get name & emal, on Submit- move file from temporary folder to Public folder, I think the issue is due to moving from temporary folder to public folder in step 2.
    – Zuhair
    Commented Apr 2, 2023 at 12:19
  • 1
    Hey did you manage to find the solution? Commented Apr 23 at 8:44

1 Answer 1

0

This comment solved it for me: https://www.drupal.org/project/feeds/issues/3108401#comment-13433861.

I had to delete some records in the DB table file_managed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.