我正在尝试为我的网站开发上传功能。我正在使用Ajax Fileupload控件进行上传。我为Ajax Fileupload控件的on uploadcomplete事件附加了一个服务器事件。
<asp:AjaxFileUpload ID="AjaxFileUpload1" runat="server" Width="350px" onuploadcomplete="AjaxFileUpload1_UploadComplete" />
以下是onuploadcomplete
protected void AjaxFileUpload1_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
{
try
{
string fileNameWithPath = Server.MapPath("./files/") + e.FileName.ToString();
AjaxFileUpload1.SaveAs(fileNameWithPath);
}
catch (Exception ex)
{
}
}
我还在maxRequestLength
中添加httpRuntime
,例如:
<httpRuntime maxRequestLength="42949672"/>
和
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="42949672"/>
</requestFiltering>
</security>
它在本地主机上正常工作,但不能在现场工作...... 在现场,它说上传错误