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. 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. Commented Apr 2, 2023 at 12:19
  • 1
    Hey did you manage to find the solution? Commented Apr 23, 2024 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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.