Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 36c976d

Browse files
committed
fix file upload protocol bug
1 parent 633bb44 commit 36c976d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/ServiceStack.Text/HttpUtils.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -989,11 +989,11 @@ public static void UploadFile(this WebRequest webRequest, Stream fileStream, str
989989
if (requestFilter != null)
990990
requestFilter(httpReq);
991991

992-
var boundary = "----------------------------" + Guid.NewGuid().ToString("N");
992+
var boundary = Guid.NewGuid().ToString("N");
993993

994-
httpReq.ContentType = "multipart/form-data; boundary=" + boundary;
994+
httpReq.ContentType = "multipart/form-data; boundary=\"" + boundary + "\"";
995995

996-
var boundarybytes = ("\r\n--" + boundary + "\r\n").ToAsciiBytes();
996+
var boundarybytes = ("\r\n--" + boundary + "--\r\n").ToAsciiBytes();
997997

998998
var headerTemplate = "\r\n--" + boundary +
999999
"\r\nContent-Disposition: form-data; name=\"file\"; filename=\"{0}\"\r\nContent-Type: {1}\r\n\r\n";

0 commit comments

Comments
 (0)