Windows, Apache 2.4.12, Drupal 7.41, FileField Sources 7.x 1.10

We defined a directory, where we copied the files via ftp - it is working without problems.
Now we want to upload a file from this directory with the attach_mode 'move', so that the file will be moved to the final destination and will be deleted in the attach directory, but the file will not be deleted. Why?

Can I track this with a log or something else? I can't find out why the files will not be deleted. Any hints?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Matroschker created an issue. See original summary.

tien.xuan.vo’s picture

I confirm this is a bug. I saw this bug when running test cases on drupal 8 version of this module. The reason is there is a wrong condition that make source file will not be deleted.

tien.xuan.vo’s picture

Assigned: Unassigned » tien.xuan.vo
Category: Support request » Bug report
Status: Active » Needs review

And sorry for the name of the patch. It should be filefield_sources-drupal_attached-file-not-removed-on-move-mode-2638914-2.patch

Matroschker’s picture

Thank you very much, the patch worked for me (comment #2)

Bohus Ulrych’s picture

Hi, this path is not working for me, I'm not able to save node - error message is:
An illegal choice has been detected. Please contact the site administrator.
Tested on fresh minimal installation of Drupal 7.56, filefield_sources 1.10

At the end I used two hooks hook_node_insert() and hook_node_update() and
unlink($node->field_my_field_name['und'][0]['filefield_attach']['filename']);

quicksketch’s picture

Issue summary: View changes
Status: Needs review » Fixed
FileSize
934 bytes

Thanks @tien.xuan.vo. I'd prefer to check the file path condition rather than remove it entirely. I have seen situations where the attach directory is the same thing as the destination, we had a dedicated issue for it at #1492374: Attach source reference existing file where it's the same as source (which is probably where this regression was created).

This patch fixes the condition and maintains the ability to have the target be the same as the destination.

  • quicksketch committed bc21dad on 7.x-1.x
    Issue #2638914: Files will not be removed from server directory with...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.