Definition at line 691 of file WebClient.cs.
692 {
694 WebHeaderCollection headers =
Headers;
695 string text = headers[
"Content-Type"];
697 {
698 text =
"application/octet-stream";
699 }
701 {
703 }
705 int num = 8192;
708 {
709 if (needsHeaderAndBoundary)
710 {
711 string text2 = $"---------------------{DateTime.Now.Ticks:x}";
712 headers["Content-Type"] = "multipart/form-data; boundary=" + text2;
713 string s =
"--" + text2 +
"\r\nContent-Disposition: form-data; name=\"file\"; filename=\"" +
Path.
GetFileName(fileName) +
"\"\r\nContent-Type: " +
text +
"\r\n\r\n";
716 }
717 else
718 {
719 formHeaderBytes =
Array.Empty<
byte>();
720 boundaryBytes =
Array.Empty<
byte>();
721 }
722 if (fs.CanSeek)
723 {
724 _contentLength = fs.Length + formHeaderBytes.Length + boundaryBytes.Length;
725 num = (int)Math.Min(8192
L, fs.Length);
726 }
727 }
728 else
729 {
730 headers[
"Content-Type"] =
text;
731 formHeaderBytes = null;
732 boundaryBytes = null;
733 if (fs.CanSeek)
734 {
736 num = (int)Math.Min(8192
L, fs.Length);
737 }
738 }
740 }
static ? string GetFileName(string? path)
static string GetFullPath(string path)
WebHeaderCollection Headers
static string net_webclient_Multipart
References System.Net.WebClient._contentLength, System.Net.WebClient._method, System.Text.Encoding.ASCII, System.buffer, System.Net.Equals, System.IO.Path.GetFileName(), System.IO.Path.GetFullPath(), System.Net.WebClient.Headers, System.L, System.Math.Min(), System.SR.net_webclient_Multipart, System.s, System.text, and System.Text.Encoding.UTF8.
Referenced by System.Net.WebClient.UploadFile(), and System.Net.WebClient.UploadFileAsync().