James
On Thursday, April 19, 2012 6:35:28 PM UTC-4, jeremyharris wrote:
-- On Thursday, April 19, 2012 6:35:28 PM UTC-4, jeremyharris wrote:
Yes, as defined in the transferTo function in your model. Here's a sample one that sticks it under a user directory and uses a UUID as the filename so there aren't conflicts (so something like /media/transfer/doc/user/550e8400-e29b-41d4-a716- 446655440000.doc): function transferTo($via, $from) {extract($from);$irregular = array('image' => 'img','text' => 'txt');$name = Mime_Type::guessName($mimeType ? $mimeType : $file);if (empty($extension)) {$extension = Mime_Type::guessExtension($mimeType ? $mimeType : $file); }if (isset($irregular[$name])) {$short = $irregular[$name];} else {$short = substr($name, 0, 3);}$path = $short . DS;$path .= 'user' . DS; // make this as dynamic as you want$path .= String::uuid(); // uses a uuid as the doc name instead$path .= !empty($extension) ? '.' . strtolower($extension) : null;return $path;}This is defined on the model that $actsAs Media.Transfer.
On Thursday, April 19, 2012 8:49:00 AM UTC-7, James Dcunha wrote:Hello all,With cake media plugin can we configure the plugin to create dynamic subdirectories dynamically inside the transfer folder without changing the plugin core code.Example with default settings I can transfer document files to WWW_ROOT/media/transfer/doc/test.doc Could we configure it to transfer document files to WWW_ROOT/media/transfer/doc/{subdirectory}/test.doc RegardsJames
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment