Guest User

Guest User

  • Tech Writer
  • 98
  • 39.9k

Disable chunking in Asp.Net Core 3.1

Feb 14 2020 11:12 AM
When I'm uploading a file when I published my Api to localhost, I keep on encountering this error
 
transfer-encoding: chunked
x-powered-by: ASP.NET
 
while using this code to upload file..
  1. var fileName = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot""newFileName.docx");  
  2. if (System.IO.File.Exists(fileName)) { System.IO.File.Delete(fileName); }  
  3. // Create new local file and copy contents of uploaded file  
  4. using (var localFile = System.IO.File.OpenWrite(fileName))  
  5. using (var uploadedFile = formFile.OpenReadStream()){  
  6. uploadedFile.CopyTo(localFile);  
  7. }  
How can I fix this?