Skip to content
This repository has been archived by the owner on Nov 16, 2022. It is now read-only.

Error while trying to delete optional files #293

Open
FraustroDesign opened this issue Jun 11, 2022 · 1 comment
Open

Error while trying to delete optional files #293

FraustroDesign opened this issue Jun 11, 2022 · 1 comment

Comments

@FraustroDesign
Copy link

I have an entity with one required file field and several optional files ("allowEmpttFile" in my model table). The upload and updating of the files work as intended without issue. The problem comes when I try to delete the entity.

It's throwing me this warning for each of the optional files not present for the entity: "rmdir( url ) [function.rmdir]: No such file or directory [in .\vendor\davidyell\proffer\src\Lib\ProfferPath.php, line 272]"

("url" in this case is the expected directory for the optional files)

The entity is deleted without issue, but CakePHP is throwing me that warning and the redirect after the deletion is not working.

Is there a way to tell Proffer not to try to delete that directory if the file was an optional field?

localhost-proffer-delete-errir

@davidyell
Copy link
Owner

I'm not sure there is code for that use-case. You would need to create your own Path class, add it to the configuration and then you could manage the deleteFiles() method yourself.

https://github.com/davidyell/CakePHP-Proffer/blob/master/src/Model/Behavior/ProfferBehavior.php#L240

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants