: : 미유의 개인사정

뒤로 검색

curl 으로 파일 전송할때 CURLOPT_POSTFIELDS 주의점

2016/06/03 16:47

5.5.0부터는 @ 만으로 파일을 전송할수 없다.
CURLFile Class를 사용해야 한다.

http://php.net/manual/en/class.curlfile.php

CURLOPT_POSTFIELDS The full data to post in a HTTP "POST" operation. To post a file, prepend a filename with @ and use the full path. The filetype can be explicitly specified by following the filename with the type in the format ';type=mimetype'. This parameter can either be passed as a urlencoded string like 'para1=val1&para2=val2&...' or as an array with the field name as key and field data as value. If value is an array, the Content-Type header will be set to multipart/form-data. As of PHP 5.2.0,value must be an array if files are passed to this option with the @ prefix. As of PHP 5.5.0, the @ prefix is deprecated and files can be sent using CURLFile. The@ prefix can be disabled for safe passing of values beginning with @ by setting the CURLOPT_SAFE_UPLOADoption to TRUE.


이 페이지는 Textcube 1.10.10 : Tempo primo 로 구동됩니다 데스크탑 화면