Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Guys

Im doing a file upload, at first i was using fineuploader, then changed to simple ajax. The error i get is similar the "xhr:An unhandled exception was thrown by the Web Application." Now this works locally but doesn't work on the server, what am I missing on IIS configs? Kindly assist.

What I have tried:

//Below is the JS

Java
var formData = new FormData();
        var file = $('#fileID')[0];

        formData.append('file', file.files[0]);
        $.ajax({
            url: '/api/document/uploads/',
            type: 'POST',
            data: formData,
            contentType: false,
            processData: false,
            success: function (result) {

            },
            error: function (result) {

            }
        });


//Below is the api
C#
[HttpPost]
[Route("api/document/uploads")]
public async Task<object> UploadDoc()
{
}
Posted
Comments
F-ES Sitecore 16-Nov-18 5:10am    
You'll need to find out what the actual error on the server is. Look at the response to the request in the network tab of the browse tools, or look at the log files on the server.
Anele Ngqandu 16-Nov-18 5:28am    
:( Only thing I get from the response is "An unhandled exception was thrown by the Web Application."
Anele Ngqandu 16-Nov-18 6:19am    
Another thing I just noticed from the Headers, the Content-Type is not showing "multipart/form-data" but showing "text/plain"
MadMyche 16-Nov-18 6:54am    
Your unhandled exceptionj means just that- there was a error being executed and that the code was not within a try-catch block. Best thing to do would be utilize a try-catch and when an error is caught log it for review.
If you want a better answer... Edit this question and include the API code; that is where the error is occurring

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900