diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-12-13 19:15:42 -0800 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-12-13 19:15:42 -0800 |
commit | fdd2da905a27fab838aa34ef7baf0ee2c5c3c5f7 (patch) | |
tree | 0b15e6b628627ddfd1ed2709bebc2e7e8a7e9e83 /include/api.php | |
parent | 2cceca49e9a0666ceaeb5758603a6ec3e5d75171 (diff) | |
download | volse-hubzilla-fdd2da905a27fab838aa34ef7baf0ee2c5c3c5f7.tar.gz volse-hubzilla-fdd2da905a27fab838aa34ef7baf0ee2c5c3c5f7.tar.bz2 volse-hubzilla-fdd2da905a27fab838aa34ef7baf0ee2c5c3c5f7.zip |
more work on api media uploads
Diffstat (limited to 'include/api.php')
-rw-r--r-- | include/api.php | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/include/api.php b/include/api.php index 9c31f994f..f37e0669f 100644 --- a/include/api.php +++ b/include/api.php @@ -855,13 +855,24 @@ require_once('include/api_auth.php'); $_REQUEST['type'] = 'wall'; if(x($_FILES,'media')) { - $_FILES['userfile'] = $_FILES['media']; - // upload the image if we have one - $_REQUEST['silent']='1'; //tell wall_upload function to return img info instead of echo - require_once('mod/wall_attach.php'); - $media = wall_attach_post($a); - if(strlen($media)>0) - $_REQUEST['body'] .= "\n\n".$media; + $num_uploads = count($_FILES['media']['name']); + for($x = 0; $x < $num_uploads; $x ++) { + $_FILES['userfile'] = array(); + $_FILES['userfile']['name'] = $_FILES['media']['name'][$x]; + $_FILES['userfile']['type'] = $_FILES['media']['type'][$x]; + $_FILES['userfile']['tmp_name'] = $_FILES['media']['tmp_name'][$x]; + $_FILES['userfile']['error'] = $_FILES['media']['error'][$x]; + $_FILES['userfile']['size'] = $_FILES['media']['size'][$x]; + + // upload each image if we have any + $_REQUEST['silent']='1'; //tell wall_upload function to return img info instead of echo + require_once('mod/wall_attach.php'); + $a->data['api_info'] = $user_info; + $media = wall_attach_post($a); + + if(strlen($media)>0) + $_REQUEST['body'] .= "\n\n" . $media; + } } } |