CakePHP-Proffer icon indicating copy to clipboard operation
CakePHP-Proffer copied to clipboard

Error while trying to delete optional files

Open FraustroDesign opened this issue 3 years ago • 1 comments

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

FraustroDesign avatar Jun 11 '22 01:06 FraustroDesign

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

davidyell avatar Jun 13 '22 15:06 davidyell