我正在使用kendo上传功能。控制器操作结果中的HttpPostedFileBase在IE11,Chrome,Firefox中始终显示为null。 但它在使用IE8,IE9时工作正常。如果有人能解决这个问题,那将会很棒。
View.cshtml
<form method="post" enctype="multipart/form-data" data-bind="kendoUpload: { async: { saveUrl: 'UploadController/Upload', autoUpload: false }, upload: OnUpload, success: OnSuccess, error: OnError, select: OnSelect, multiple: false }">
<input name="fileUpload" type="file" id="fileUpload" />
</form>
Controller.cs
public virtual ActionResult Upload(HttpPostedFileBase fileUpload) { //Perform some action }
答案 0 :(得分:1)
尝试从<input type=file>
而不是<form>
创建上传。
<form method="post" enctype="multipart/form-data" >
<input name="fileUpload" type="file" id="fileUpload"
data-bind="kendoUpload: { async: { saveUrl: 'UploadController/Upload', autoUpload: false }, upload: OnUpload, success: OnSuccess, error: OnError, select: OnSelect, multiple: false }" />
</form>