我想上传文件,我收到以下错误消息
{"errors":["undefined method tempfile'for\"@/files/media/keywords.csv\":String"]}
这是我的代码
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://app.simpli.fi/api/organizations/57979/campaigns/2156268/keywords'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); $post = array( 'keyword[csv]' => '@' .realpath('./files/media/keywords.csv'), 'keyword[append]' => 'true' ); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); $headers = array(); $headers[] = 'X-App-Key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; $headers[] = 'X-User-Key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $result = curl_exec($ch); echo "<pre>"; print_r($result); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } curl_close($ch); die;