Search

Problem uploading attachment through api

Subscribe to Problem uploading attachment through api 1 post(s)

 
mihai.anghel

Hello,
I am trying to add attachments through the api for a ticket.I am using curl from PHP and I when I send the file to get the upload key I am doing something like this :
$fields = array( ‘filename’ => ‘@’ . $file[‘tmp_name’] );
curl_setopt( $ch, CURLOPT_POST, TRUE );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $fields );

The attachment is uploaded, the problem is that at the begginng of the file I see three lines like:
-—————————————-b6345709d746

Content-Disposition: form-data; name=“filename”; filename=“phpU0EUBH”

Content-Type: application/octet-stream

and at the end of the file
-—————————————-b6345709d746—

Has anyone any idea what could be causing this ?

Thank you very much.