locked
AjaxFileUpload Upload error RRS feed

  • Question

  • User1396448631 posted

    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

    Wednesday, March 2, 2016 7:18 PM

Answers

  • User1396448631 posted

    Thank you Fei Han.

    It turned out to be a permission issue.

    The user/account using AjaxFileUpload control should have write permission on the Path.GetTempPath which is generally the C:\Windows\Temp folder.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 3, 2016 6:20 PM

All replies

  • User61956409 posted

    Hi dbqasp,

    Firstly, you could try to uninstall and reinstall AJAX Control Toolkit.

    Secondly, this tutorial explained how to use AjaxFileUpload Control with complete example.

    http://stephenwalther.com/archive/2013/04/30/april-2013-release-of-the-ajax-control-toolkit

    Best Regards,

    Fei Han

    Thursday, March 3, 2016 9:33 AM
  • User1396448631 posted

    Thank you Fei Han.

    It turned out to be a permission issue.

    The user/account using AjaxFileUpload control should have write permission on the Path.GetTempPath which is generally the C:\Windows\Temp folder.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 3, 2016 6:20 PM