-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove file doesn't work when using folderAsField #33
Comments
Anyone who can confirm this? |
Been thinking a little about this.. Wouldn't it be more flexible to enhance _replaceTokens to handle tokens like {Model.field}? That way, you could construct the path exactly as you wish, and you'd get rid of the clunky "folderAsField".. |
Hi, Yes, this is a problem. I was just going to add an issue. Currently, only the method _uploadFile deals with the folderAsField setting. Part of the problem maybe because it relies on model data from the DB, so it's probably not always available when setup() is run. When delete() comes around, it's only got this set (from setup()) and possibly doesn't have |
I know this isn't the way to do it, but my git skills aren't too flash. This fixes the issue, possibly not the nicest but does the trick for now, beforeDelete already reads the data so it's just a matter of using it again:
|
The only place folderAsField is considered is when uploading.
In setup(), $options['dir'] doesn't get this extra field which leads to afterSave() calling _deleteFiles() only with that dir, missing for example the model id at the end.
The text was updated successfully, but these errors were encountered: