I actually have it like this: $filename = $this->Banner-
>moveUploadedFile( $this->Banner->id , $data['file']['type'] , $data
['file']['tmp_name'] )
and the function in the model class is:
function moveUploadedFile( $id , $mime_type , $path ) {
$extension = $this->filetypes[$mime_type];
$filename = WWW_ROOT.'files'.DS.'banner_'.$id.$extension;
if (!move_uploaded_file( $path, $filename )) {
$this->delete( $id );
return false;
} else {
return $filename;
}
}
I have also set the $filetypes class attribute as:
var $filetypes = array( 'image/jpeg' => '.jpg' , 'image/png' =>
'.png' .... etc);
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---