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