Created
April 15, 2018 14:10
-
-
Save niteshsri/4951c8a67f67c57ed39e9f751048716e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
code at server A: | |
$req=[ | |
'user'=>[ | |
'first_name'=>$data['first_name'], | |
'last_name'=>$data['last_name'], | |
'email'=>$data['email'], | |
'phone'=>$data['phone'], | |
], | |
'user_details'=>[ | |
'gender'=>$data['gender'], | |
'bio'=>$data['bio'], | |
'dob'=>$data['dob'], | |
] | |
]; | |
$data = new FormData(); | |
$file = $data->addFile('imageFile', fopen($this->request->data['profile_image_name']['tmp_name'], 'r')); | |
$file->contentId($this->request->data['profile_image_name']['name']); | |
$file->disposition('attachment'); | |
$http = new Client(); | |
$response = $http->put( | |
<url>, | |
(string) $data, | |
['headers' => ['Content-Type' => $data->contentType()]] | |
); | |
pr($response->body());die; | |
code at API server: | |
pr( $this->request);die; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cake\Http\ServerRequest Object
(
[params] => Array
(
[pass] => Array
(
)
Content-Disposition: attachment; name="imageFile"; filename="phpm05imk"
Content-Type: image/jpeg; charset=binary
Content-ID:
�����JFIF������C���������� �
�
��������������� $.' ",#��(7),01444�'9=82<.342��C� ��
�2!�!22222222222222222222222222222222222222222222222222����������"�������������������������������������������� ��bi�&&7Q���H@�0��,��
�f��4�����"�)e�Ŵ�iu���r�+3��Fk��4�2�^�5�\�!������& �L�� �M�L���j��
��&��B��@���)1BEsVF6�e���n��$�f�3%�sKKh,�k�w.�鲤�ȕ��0�QVȘ���[.SN��U�������@Ā"0@P��� �My� �R���@��1��1��
ښ��˚�3���u�j��s�ȹ��Yw_;��{�'�^��y�;t�;Uu��x.�5��qЖ�[������%��*\B�%(�],�5��h��
�
�!&���0����nWc�R���@P���0�!�
��Pq�Z]�F%+�M+�������]��������_=ɒ�a+��P��潥���!���Nr���z����u"��d�R�2�Q� N�G����9芥D��@��j��#B��ʉ%��q�� א����0�$S��
�E��L�ۃR��δWs���k�d��~:i�0�s�;c6e%=��j(N��+�3��#��%��w�q�r �$�����O*�5jB�p1�+*S�Ȱ��5�E�\���ZV�ht���M���Nm��+�͆�����
HD�4���"I@IJ�����J�h%dj����R��)�����.}���jR��l�e��q�f��