DEV

FileBinderの設定

引用:CakePHPの超便利なファイルアップロードプラグイン、FileBinderプラグインの使い方をまとめてみた。

public $actsAs = array(
'Filebinder.Bindable' => array(
'model' => 'Attachment', // ファイル情報を保存するモデル名
'filePath' => WWW_ROOT . 'img' . DS, // ファイルを保存するディレクトリ(絶対パス)
'dbStorage' => true, // ファイルをバイナリデータとしてデータベースに保存するか
'beforeAttach' => null, // フック関数(ファイル保存前)
'afterAttach' => null, // フック関数(ファイル保存後)
'withObject' => false, // 検索結果にファイルのバイナリデータを付加するか
)
);