If it helps I can tell you how I do it using the Uploader plugin.
On Wednesday, October 2, 2013 1:17:45 PM UTC-4, Hugo Fabricio wrote:
-- In the model using Uploader create a function to generate the new name for you.
public function generateFilename(){
return md5(rand(0000, 9999));
}
In the model using the Uploader attachment behavior attach the new name to uploaded file by referencing your function.
public $actsAs = array(
'Uploader.Attachment' => array(
'fileName' => array(
'name' => 'generateFilename'
In the metaColumns section of the behavior make sure you map the name to the correct database field.
'metaColumns' => array(
'name' => 'name'
That's it. I'm using an older version of Uploader. Pay attention to what version you are using because things are slightly different in the newest version but the end result is exactly the same.
HTH
On Wednesday, October 2, 2013 1:17:45 PM UTC-4, Hugo Fabricio wrote:
How to rename the name of a file to send by Upload plugin 2.0?grateful
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.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment