Thursday 1 February 2018

Failed to load resource: the server responded with a status of 404 (Not Found) api/upload/fileupload

the server responded with a status of 404 when trying to upload images more than 2 mb

Failed to load resource: the server responded with a status of 404 (Not Found)      api/upload/fileupload

And If It is also

Failed to load resource: the server responded with a status of 500 (Internal Server Error)  api/upload/fileupload

Then we have to add

 <httpRuntime targetFramework="4.5" maxRequestLength="1000000" /> in
  <system.web>  </system.web>

and

 <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="1073741824" />
      </requestFiltering>
    </security>


in <system.webServer> </system.webServer>

i.e.,
<system.web>
    <authentication mode="None" />
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" maxRequestLength="1000000" />
</system.web>
<system.webServer>
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="1073741824" />
      </requestFiltering>
    </security>
</system.webServer>
Here,  maxAllowedContentLength="1073741824" means, the api allows maximum length of content 1073741824 bytes i.e., 1 GB data

maxRequestLength="1000000" means the max file upload size is 1000000 kilobytes i.e, 1000 mb = 1  GB

No comments:

Post a Comment

Note: only a member of this blog may post a comment.