解决方法
以下是它对我有用的原因:
JS:
$(document).ready(function () { $(".attachmentUpload").kendoUpload({ async: { saveUrl: "SaveAttachment.aspx",autoUpload: true } }); });
页:
<input name="attachmentUpload" id="attachmentUpload" type="file" class="attachmentUpload" />
SaveAttachment.aspx.cs
public partial class SaveAttachment : Page { protected void Page_Load(object sender,EventArgs e) { Response.Expires = -1; try { HttpPostedFile postedFile = Request.Files["attachmentUpload"]; //do something with your postedfile Response.ContentType = "application/json"; Response.Write("{}"); } catch (Exception ex) { Response.Write(ex.ToString()); } } }
SaveAttachment.aspx:
<%@ Page Language="C#" CodeBehind="SaveAttachment.aspx.cs" Inherits="Nstar.WebUI.Pages.SaveAttachment" EnableTheming="false" StyleSheetTheme="" Theme="" %>