Not able to get the size of the uploaded image using the multipart form data in web api C#.
I have used the code provided on the following website: https://yogeshdotnet.com/web-api-2-file-upload-asp-net-mvc/
dataitem.Headers.ContentDisposition.FileName
"\"TEST.png\""
dataitem.Headers.ContentDisposition.Size
null
dataitem.Headers.ContentDisposition
{form-data; name="test_image"; filename="TEST.png"}
CreationDate: null
DispositionType: "form-data"
FileName: "\"TEST.png\""
FileNameStar: null
ModificationDate: null
Name: "\"test_image\""
Parameters: Count = 2
ReadDate: null
Size: null
size is null here. I want the size of the image. I ran this code in the immediate window.
HttpPostedFile file = HttpContext.Current.Request.Files["test_image"];
//size of the image in bytes.
int size = file.ContentLength;
This helped me to get the size of the image.