質問編集履歴
2
コードの修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -10,13 +10,13 @@
|
|
10
10
|
###該当のソースコード
|
11
11
|
```php
|
12
12
|
/********controller保存該当部分*************/
|
13
|
-
|
13
|
+
//画像ファイル名
|
14
|
-
|
14
|
+
$data ['Image'] ['imagefile_name'] = $data ['Image'] ['imagefile'] ['name'];
|
15
|
-
|
15
|
+
$data ['Image'] ['filetype'] = $data['Image']['imagefile']['type'];
|
16
|
-
|
16
|
+
//画像ファイルデータ
|
17
|
-
|
17
|
+
$data ['Image'] ['imagefile'] = file_get_contents( $data ['Image'] ['imagefile'] ['tmp_name'] );
|
18
|
-
|
18
|
+
// 保存
|
19
|
-
|
19
|
+
if ( $this->Image->save ( $data )) {
|
20
20
|
|
21
21
|
|
22
22
|
/********controller出力該当部分*************/
|
1
ご指摘いただきありがとうございます。コード修正しました。\$image\['Image'\]\['filetype'\] はとれています("image/jpeg"が入っていました。)。
title
CHANGED
File without changes
|
body
CHANGED
@@ -8,6 +8,7 @@
|
|
8
8
|
よろしくお願いします。
|
9
9
|
|
10
10
|
###該当のソースコード
|
11
|
+
```php
|
11
12
|
/********controller保存該当部分*************/
|
12
13
|
//画像ファイル名
|
13
14
|
$data ['Image'] ['imagefile_name'] = $data ['Image'] ['imagefile'] ['name'];
|
@@ -30,4 +31,5 @@
|
|
30
31
|
}
|
31
32
|
|
32
33
|
/********ctp出力該当部分*************/
|
33
|
-
<?php echo $this->Html->image( "/Images/contents/" . $imagefile_name);?>
|
34
|
+
<?php echo $this->Html->image( "/Images/contents/" . $imagefile_name);?>
|
35
|
+
```
|