teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

配列にしてみた

2017/05/05 07:37

投稿

chNOBUNAGA
chNOBUNAGA

スコア41

title CHANGED
File without changes
body CHANGED
@@ -28,4 +28,38 @@
28
28
 
29
29
 
30
30
 
31
- どうぞよろしくお願いします。
31
+ どうぞよろしくお願いします。
32
+
33
+ 追記
34
+
35
+
36
+ 下記のように編集しましたが、うまくアップロードされないようです。
37
+ ```PHP
38
+ $facebook = $this->__login();
39
+ $name_array=explode(',',$name);
40
+ $mime_array=explode(',',$mime);
41
+ $filename="";
42
+ $img_array=array();
43
+ for($k=0;$k<count($name_array);$k++){
44
+ $filename=WWW_ROOT.'contents/'.$name_array[$k].'.'.$mime_array[$k];
45
+ array_push($img_array,$facebook->fileToUpload($filename));
46
+ }
47
+ $post['source']=$img_array;
48
+
49
+ try {
50
+ $response = $facebook->post('/me/photos', $post, $access_token);
51
+ } catch(Facebook\Exceptions\FacebookResponseException $e) {
52
+ // When Graph returns an error
53
+ echo 'Graph returned an error: ' . $e->getMessage();
54
+ exit;
55
+ } catch(Facebook\Exceptions\FacebookSDKException $e) {
56
+ // When validation fails or other local issues
57
+ echo 'Facebook SDK returned an error: ' . $e->getMessage();
58
+ exit;
59
+ }
60
+
61
+ ```
62
+
63
+ error内容
64
+
65
+ Graph returned an error: (#324) Requires upload file