お世話になっております。
以下のように記述したのですが、アップロードされません。
どこで違うのかご指摘いただけたら助かります。
よろしくお願いいたします。
app/Config/bootstrap.php
CakePlugin::load('AmazonWebServices');
app/Config/database.php
class DATABASE_CONFIG {
//... public $s3 = array( 'datasource' => 'AmazonWebServices.S3', 'bucket_name' => '', 'key' => '', 'secret' => '', 'default_cache_config' => '', 'certificate_authority' => false );
}
<?php class Uploads extends AppModel { public $name = 'Uploads'; public $useDbConfig = 's3'; } Controller public function add() { // ユーザー情報の取得と挿入 $user = $this->Auth->user('username'); $user = AuthComponent::user('username'); $this->set("user",$user); $this->request->data['Upload']['user_id'] = $this->Auth->user('id'); $this->request->data['Upload']['username'] = $this->Auth->user('username'); $upload = $this->request->data['Upload']; if (isset($uplaod['file']['tmp_name'])) { $tmpfile = $upload['file']['tmp_name']; $filename = $upload['file']['name']; // S3にputする $result = $this->Upload->putFile($upload['file']['tmp_name'], $filename); if ($result) { $this->Session->setFlash("${result}にファイルを保存しました"); } else { $this->Session->setFlash("ファイルの保存に失敗しました"); } } $this->render('index'); } <?php echo $this->Form->create('Upload', array('action' => 'add', 'type' => 'file')); ?> <?php echo $this->Form->file('file', array('type' => 'file')); ?> <?php echo $this->Form->submit('アップロード'); ?> <?php echo $this->Form->end() ?>