Hi! I am trying to upload images to teambox.com using curl and php, but I always get the error "Invalid file name", "you can't upload a blank file", and "Invalid Record".
Any suggestions on how to fix it?
here's my code:
$fields = array(
'file' => file_get_contents($_FILES['upload_field_'.$task_id]['tmp_name'])
);
$fields_string = http_build_query($fields);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch,CURLOPT_POSTFIELDS,$json_string);
$http_result = curl_exec($ch);
$error = curl_error($ch);
$http_code = curl_getinfo($ch ,CURLINFO_HTTP_CODE);
curl_close($ch);