0
我想上傳文本文件到Rails服務器上的紅寶石。我成功地通過CLI上傳文件:C LibCurl文件上傳到Rails服務器上的紅寶石
curl -X POST --data-urlencode [email protected]/etc/filepath/ www.example.com/path
現在,通過下與libcurl的嘗試:
FILE *fd;
fd = fopen(file_path, "rb");
if (!fd)
return -1;
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
curl_easy_setopt(curl, CURLOPT_POST, 1L);
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
curl_easy_setopt(curl, CURLOPT_READDATA, fd);
}
任何想法,爲什麼通過命令行會的工作運行,但libcurl的沒有?我錯過了一些捲曲選項還是我的服務器需要替代配置?
感謝