And I failed to post anything, from what django could make request. Aslo wierdshark shown that MS does a bit strange request (it looses some header about multipart form-data).
Today I took libcurl, it has a rich example who you can perform your POST-request.
Note, that it's just example and you have to define a record and a record_length.
As for me, I took such piece of code from there:
CURL *curl;
CURLcode res;
//
curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
struct curl_httppost* post = NULL;
struct curl_httppost* last = NULL;
struct curl_forms forms[2];
char file1[] = "d:\\backup\\thumb.jpg";
forms[0].option = CURLFORM_FILE;
forms[0].value = file1;
forms[1].option = CURLFORM_END;
curl_formadd(&post, &last, CURLFORM_COPYNAME,
"pictures",
CURLFORM_ARRAY, forms, CURLFORM_END);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
Pretty enough. But python is always prettier: snippet
;)
0 comments:
Post a Comment