Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct curl_slist *headerlist = NULL;
- const char * Picture = "C:xxxx";
- FILE *fd = fopen(Picture, "rb");
- struct stat file_info;
- fstat(fileno(fd), &file_info);
- headerlist = curl_slist_append(headerlist, "user : xxxx");
- headerlist = curl_slist_append(headerlist, "password : xxxxx");
- headerlist = curl_slist_append(headerlist, "Content-Type: image/jpeg");
- curl = curl_easy_init();
- curl_easy_setopt(curl, CURLOPT_URL, "http://xxxx.000webhostapp.com/Pictures");
- curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist);
- curl_easy_setopt(curl, CURLOPT_POST, 1L);
- curl_easy_setopt(curl, CURLOPT_READDATA, fd);
- curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (curl_off_t)file_info.st_size);
- res = curl_easy_perform(curl);
- if (res != CURLE_OK)
- {
- MessageBox::Show("Picture Failed");
- }
- curl_easy_cleanup(curl);
- curl_global_cleanup();
Add Comment
Please, Sign In to add comment