Modify permissions if destination directory exists

Created on 18 January 2017, about 8 years ago
Updated 4 December 2024, about 2 months ago

I have a migrate script routine that sets file references for several nodes. I was finding that the paths to these files were not matching up with the path settings that I had configured on the file field. It turned out to be an issue with the call to file_prepare_directory(). In my case, the destination directory had already existed, but I was receiving this error:

[notice] The file public://private/press_release/additional/5-steps-cert-dev-exam_0_0.pdf could not be moved to the destination of public://private/press_release/additional/5-steps-cert-dev-exam_0_0.pdf. Ensure your permissions are set correctly.

Note: The log message doesn't display the destination directory -- a patch has been submitted for that here: Logger does not record new file destination on failed move

I don't think this is an issue with my system's file permissions, because files were being placed in the expected directory when I was attaching files manually (via the node form).

🐛 Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

🇺🇸United States rvillan

Live updates comments and jobs are added and updated live.
  • Needs reroll

    The patch will have to be re-rolled with new suggestions/changes described in the comments in the issue.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024