PHPcurl api中没有读取文件名

时间:2016-08-23 11:06:15

标签: php-curl

我使用phpcurl集成了api。有上传文件功能。当使用PHP代码调用带有参数的Webservices时。文件名不会被添加

curl_setopt_array($curl, array(
CURLOPT_URL => "https://Xx.XXX.XXX.XX/demo/v1/uploadScannedDocs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"preQualify\"\r\n\r\n" . $checkbox1 . "\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"demographicPid\"\r\n\r\n" . $patient_id . "\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"barcode\"\r\n\r\n" . $barcode . "\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"consentDate\"\r\n\r\n" . $consent_date . "\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"CSCDB_0523_TableDef.pdf\"\r\nContent-Type: false\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"hipa\"; filename=\"CSCDB_0523_TableDef.pdf\"\r\nContent-Type: false\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"medrioId\"\r\n\r\n" . $id . "\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache",
    "content-type: multipart/form-data; boundary=---011000010111000001101001",
    "deviceid: 123",
    "postman-token: 4655c7e4-f473-7383-6fd1-ef07ded61caf",
    "token: 1234"
)));

0 个答案:

没有答案