Hi,
I am using AjaxFileUpload control to upload file to server.
When I select file and click on the Upload button, I am getting the following error
AjaxFileUploadHandler.axd?contextKey=AjaxFileUp…24-D69D-E4EA58669449&fileName=S501662082.pdf&chunked=false&firstChunk=true Failed to load resource: the server responded with a status of 500 (Internal Server Error)
?contextKey=AjaxFileUpload1&done=1&guid=CC11D3F8-931E-9024-D69D-E4EA58669449 Failed to load resource: the server responded with a status of 500 (Internal Server Error)
ScriptResource.axd:1314 Uncaught error raising upload complete event and start new upload
protected void AjaxFileUpload1_OnUploadComplete(object sender, AjaxFileUploadEventArgs file)
{
string fileName = Path.GetFileNameWithoutExtension(file.FileName) + ".pdf";
Session["fileName"] = fileName;
try
{
AjaxFileUpload1.SaveAs(MapPath("~/uploads/" + fileName));
}
catch (Exception ex)
{
messageLbl.Text = ex.Message + "<br />" + ex.StackTrace + "<br /><br />";
}
}<asp:AjaxFileUpload ID="AjaxFileUpload1" runat="server" Padding-Bottom="4"
Padding-Left="2" Padding-Right="1" Padding-Top="4"
OnUploadComplete="AjaxFileUpload1_OnUploadComplete" MaximumNumberOfFiles="1"
AllowedFileTypes="pdf"/><system.web><compilation debug="true" targetFramework="4.0" /><httpRuntime maxRequestLength="42949672" /><httpHandlers><add verb="*" path="AjaxFileUploadHandler.axd" type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit"/></httpHandlers></system.web><system.webServer><validation validateIntegratedModeConfiguration="false"/><handlers><add name="AjaxFileUploadHandler" verb="*" path="AjaxFileUploadHandler.axd" type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit"/></handlers><security><requestFiltering><requestLimits maxAllowedContentLength="4294967295"/></requestFiltering></security></system.webServer>
Please let me know if you have faced this problem or the probable solution.
Thank you