質問編集履歴

1

配列にしてみた

2017/05/05 07:37

投稿

chNOBUNAGA
chNOBUNAGA

スコア41

test CHANGED
File without changes
test CHANGED
@@ -59,3 +59,71 @@
59
59
 
60
60
 
61
61
  どうぞよろしくお願いします。
62
+
63
+
64
+
65
+ 追記
66
+
67
+
68
+
69
+
70
+
71
+ 下記のように編集しましたが、うまくアップロードされないようです。
72
+
73
+ ```PHP
74
+
75
+ $facebook = $this->__login();
76
+
77
+ $name_array=explode(',',$name);
78
+
79
+ $mime_array=explode(',',$mime);
80
+
81
+ $filename="";
82
+
83
+ $img_array=array();
84
+
85
+ for($k=0;$k<count($name_array);$k++){
86
+
87
+ $filename=WWW_ROOT.'contents/'.$name_array[$k].'.'.$mime_array[$k];
88
+
89
+ array_push($img_array,$facebook->fileToUpload($filename));
90
+
91
+ }
92
+
93
+ $post['source']=$img_array;
94
+
95
+
96
+
97
+ try {
98
+
99
+ $response = $facebook->post('/me/photos', $post, $access_token);
100
+
101
+ } catch(Facebook\Exceptions\FacebookResponseException $e) {
102
+
103
+ // When Graph returns an error
104
+
105
+ echo 'Graph returned an error: ' . $e->getMessage();
106
+
107
+ exit;
108
+
109
+ } catch(Facebook\Exceptions\FacebookSDKException $e) {
110
+
111
+ // When validation fails or other local issues
112
+
113
+ echo 'Facebook SDK returned an error: ' . $e->getMessage();
114
+
115
+ exit;
116
+
117
+ }
118
+
119
+
120
+
121
+ ```
122
+
123
+
124
+
125
+ error内容
126
+
127
+
128
+
129
+ Graph returned an error: (#324) Requires upload file