File tree Expand file tree Collapse file tree 1 file changed +4
-10
lines changed
Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -430,7 +430,7 @@ public function uploadPhoto($uri, $file)
430430 $ boundary = uniqid ();
431431 $ delimiter = '------------- ' .$ boundary ;
432432
433- $ postData = $ this ->buildDataFiles ($ boundary , $ fields , $ files );
433+ $ postData = $ this ->buildDataFiles ($ boundary , $ files );
434434
435435 $ url = $ this ->baseUrl .$ uri ;
436436 $ ch = curl_init ();
@@ -467,23 +467,17 @@ public function uploadPhoto($uri, $file)
467467 /**
468468 * @return string file content and post data
469469 */
470- public function buildDataFiles ($ boundary , $ fields , $ files )
470+ public function buildDataFiles ($ boundary , array $ files ): string
471471 {
472472 $ data = '' ;
473473 $ eol = "\r\n" ;
474474
475475 $ delimiter = '------------- ' .$ boundary ;
476476
477- foreach ($ fields as $ name => $ content ) {
478- $ data .= '-- ' .$ delimiter .$ eol
479- .'Content-Disposition: form-data; name=" ' .$ name .'" ' .$ eol .$ eol
480- .$ content .$ eol ;
481- }
482-
483477 foreach ($ files as $ name => $ content ) {
484478 $ data .= '-- ' .$ delimiter .$ eol
485- .'Content-Disposition: form-data; name=" ' .$ name .'"; filename=" ' .$ name .'" ' .$ eol
486- //. 'Content-Type: image/png'.$eol
479+ .'Content-Disposition: form-data; name=" ' .$ name .'"; filename=" ' .$ name .'.png " ' .$ eol
480+ . 'Content-Type: image/png ' .$ eol
487481 .'Content-Transfer-Encoding: binary ' .$ eol
488482 ;
489483
You can’t perform that action at this time.
0 commit comments