I am having a small issue where the image im sending from postman is not populated into my model when using BindAndValidate method.
Here is my model :
public class Photo {
public string date {get; set;}
public byte[] image {get; set;}
}
And here is my actual call :
curl -k -X POST \
http://localhost:8888/upload \
-H 'Content-Type: multipart/form-data' \
-H 'cache-control: no-cache' \
-H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
-F 'image=@\\LAPTOP\USERDAT01\MATIAS\Desktop\image.jpg' \
-F date=2019-10-16
The problem im facing is that although date field on my model is actually getting populated the image property is always null.
This is my module code :
var request = req.BindAndValidate<Photo>();
uploadPhoto(request.data.date, request.data.image)
What am I doing wrong?
I finally solved it as :
Thanks!