Advertisement
Guest User

Untitled

a guest
Jul 29th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. string postdata;
  2. postdata = "?";
  3. Uri uri = new Uri(url + postdata);
  4. string boundary = "----------" + DateTime.Now.Ticks.ToString("x");
  5. HttpWebRequest webrequest = (HttpWebRequest)WebRequest.Create(uri);
  6. webrequest.ContentType = "multipart/form-data; boundary=" + boundary;
  7. webrequest.Method = "POST";
  8. // Build up the post message header
  9. StringBuilder sb = new StringBuilder();
  10. sb.Append("--");
  11. sb.Append(boundary);
  12. sb.Append("\r\n");
  13. sb.Append("Content-Disposition: form-data; name=\"");
  14. sb.Append(fileFormName);
  15. sb.Append("\"; filename=\"");
  16. sb.Append(Path.GetFileName(uploadedfile));
  17. sb.Append("\"");
  18. sb.Append("\r\n");
  19. sb.Append("Content-Type: ");
  20. sb.Append(contenttype);
  21. sb.Append("\r\n");
  22. sb.Append("\r\n");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement