簡體   English   中英

Kendo.Ui.Core上載異步在MVC3應用程序中始終返回null

[英]Kendo.Ui.Core Upload async always returns null in MVC3 application

我正在使用Kendo UI Core腳本(版本2013.2.918)在ASP.NET MVC3應用程序中異步上傳文件。 或者,至少,我正在嘗試。

它可以正確調用該動作,但是參數始終為null。 這是代碼。

<form method="post" action="submit">
    <input id="fiAwardUploader" type="file"/>
</form>

$(document.ready(fuction(){
    $('#fiAwardUploader').kendoUpload({
        async:{
            saveUrl: '@(Url.Action("UploadAwardDocument"))',
            autoUpload: false //this is done for testing purposes
        }
     });
 });

 [HttpPost]
 public ActionResult UploadAwardDocument(IEnumerable<HttpPostedFileBase> fiAwardUploader)
 {
     var test = files; //this is always null
     return null;
 }

我也嘗試過將表單設置為動作,但是它仍然做同樣的事情。 我已經嘗試按照KendoUI MVC3約定將UploadAwardDocument的參數命名為files ,但是仍然返回null。

拼寫錯誤只是在必須連接互聯網的筆記本電腦上重新輸入代碼的問題。 除了fiAwardUploader參數為null以外的所有內容都可以正常工作。 由於遺留的編碼問題,該應用無法在此處發布信息-上傳必須是異步的。 由於預算限制和我的個人喜好,我們將不再使用KendoUI MVC3 Professional Suite。

我被困住了,距離必須放棄KendoUI解決方案並找到另一個異步上傳工具僅16個小時。

弄清楚了。 <input id="fiAwardUploader" type="file"/>需要設置名稱。 <input id="fiAwardUploader" name='fiAwardUploader' type="file"/>起作用。

KendoUI文檔中沒有明確記錄該文檔,而MVC3文檔中對此進行了提及,但面對此特定問題時,顯然並沒有明顯的關聯。

因此,我將把問題留在原處,希望它能對其他人有所幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM