0
비슷한 질문을 여러 번 시도했지만 명확한 답변이 없지만 여전히 문제가 있습니다. HttpPostedFileBase is null - AngularJS에서 MVC로 파일 올리기
이
은public class SubmitModel
{
public string Name { get; set; }
public HttpPostedFileBase File { get; set; }
public IEnumerable<HttpPostedFileBase> Files { get; set; }
}
이것은 MVC 코드
[HttpPost]
public ActionResult Test(SubmitModel model)
{
// Here model.File and model.Files is always null
}
입니다 이것은 내가 AngularJS와 당신이 알고 싶은 경우에
var data = {
name: scope.name, // This is passed to MVC successfully
file: scope.files[0], // Doesn't even work with single file
files: scope.files // This is a FileList
};
$http.post("/umbraco/surface/MyController/Test", data).success(...);
을 사용하여 제출 무엇 C#에서 모델이 얼마나 I 할당 scope.files
:
$('#upload').on('change', function (e) {
scope.$apply(function() {
scope.files = e.target.files;
});
});
내가 누락 된 부분을 볼 수 있습니까?