Here's my beforeTransform and beforeUpload:
public function beforeTransform( $options ) {
$options['finalPath'] = 'files/uploads/' . CakeSession::read( 'Auth.User.id' ) . '/';
$options['uploadDir'] = WWW_ROOT . $options['finalPath'];
return $options;
}
public function beforeUpload( $options ) {
$options['finalPath'] = 'files/uploads/' . CakeSession::read( 'Auth.User.id' ) . '/';
$options['uploadDir'] = WWW_ROOT . $options['finalPath'];
return $options;
}
As you can see, I'm placing all my files under /files/uploads/ <!-- User ID Folder--> /test.jpg
Now, if I upload my files and just place them under /files/uploads, then delete them, the files are physically removed from the server. It's just when they're placed in a sub folder from the above methods, that it won't physically remove them. Also, when this happens (the files not being deleted), the row is removed from the DB.
Secondly, is there anyway when uploading files, to only keep the transformed files? I'd like to just keep a medium and small photo, and remove the other. I'm guessing I could do an after save, and possibly execute the following? $this->Image->deleteFiles($id, array('medium')); Though, how would I delete the original only?
-- Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment