Guest User

Untitled

a guest
Jun 24th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. [WebMethod]
  2. public string UploadFile(byte[] data)
  3.  
  4. static TCHAR hdrs[] = "Content-Type: application/x-www-form-urlencoded";
  5. static TCHAR frmdata[] = "data=temp.txt";
  6. HINTERNET hSession = InternetOpen("MyAgent",INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
  7. HINTERNET hConnect = InternetConnect(hSession, "localhost",
  8. INTERNET_DEFAULT_HTTP_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 1);
  9. HINTERNET hRequest = HttpOpenRequest(hConnect, "POST", "my/WebService.asmx/UploadFile", NULL, NULL, 0, 0, 1);
  10. HttpSendRequest(hRequest, hdrs, strlen(hdrs), frmdata, strlen(frmdata));
Add Comment
Please, Sign In to add comment