0
libcurl을 사용하여 내 ruby 서버에 wav 파일을 보내려고합니다. 그것은 여기에 코드의 주요 조각의 다중 형태의 게시물입니다 :Libcurl이 오디오 파일을 보내려면
curl_easy_setopt(curl, CURLOPT_URL, "192.168.0.136:3000/upload");
struct curl_httppost *post = NULL;
struct curl_httppost *last = NULL;
//Added longer timeout in case of large files
//Two forms, one for file and another for data
curl_formadd(&post, &last, CURLFORM_COPYNAME, "file", CURLFORM_FILECONTENT, "log1.wav", CURLFORM_END);
curl_formadd(&post, &last, CURLFORM_COPYNAME, "data", CURLFORM_PTRCONTENTS, data, CURLFORM_END);
curl_easy_setopt(curl, CURLOPT_HTTPPOST, post);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&respons_buf);
res = curl_easy_perform(curl);
내가 함께 할 확실하지 오전하는 인코딩 된 텍스트로 파일을받을 수 있습니다. 이것은 텍스트 파일을 보낸 동일한 방법입니다. 헤더 정보가 누락 되었습니까?