Guest User

Untitled

a guest
Oct 15th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. --145ae7dc-e075-478c-8063-eeb765e0e15a
  2. Content-Type: image/jpeg;
  3. Content-Length: 41946
  4. MIME-Version: 1.0
  5.  
  6. ÿØÿî Adobe d ÿÃ R G B ÿÄ ÿÚ R G B úÿ ×þ¿Úív¡
  7.  
  8. WebClient webClient = new WebClient();
  9. webClient.Headers["Accept"] = textBoxMimeType.Text;
  10.  
  11. var uri = new Uri(url);
  12. using (Stream webStream = webClient.OpenRead(uri))
  13. {
  14. using (FileStream fileStream = new FileStream(outputFile, FileMode.Create))
  15. {
  16. var buffer = new byte[32768];
  17. int bytesRead;
  18. Int64 bytesReadComplete = 0;
  19. Int64 bytesTotal = Convert.ToInt64(webClient.ResponseHeaders["Content-Length"]);
  20.  
  21. while ((bytesRead = webStream.Read(buffer, 0, buffer.Length)) > 0)
  22. {
  23. bytesReadComplete += bytesRead;
  24. fileStream.Write(buffer, 0, bytesRead);
  25. }
  26. }
  27. }
Add Comment
Please, Sign In to add comment