I'm using cURL with PHP. I need to post the content of a buffer so that the server sees it as a file upload. This what I tried:
$post_data['Filename'] = "foo.wav";
$post_data['File'] = $filedata;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $myurl);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
This sends the buffer content as a normal form field and not as a file upload. The examples for uploading a file assume the file was not already read in memory and require the file path to be set with a '@' in front. How can I upload my buffer as though it was a file, without writing my buffer to disk of course?