Anele Ngqandu

Anele Ngqandu

  • 1.3k
  • 429
  • 27.8k

Uploading file using Ajax & Dramatic IIS

Nov 16 2018 3:22 AM
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.
 
//Below is the JS 
  1. var formData = new FormData();  
  2.         var file = $('#fileID')[0];  
  3.   
  4.         formData.append('file', file.files[0]);  
  5.         $.ajax({  
  6.             url: '/api/document/uploads/',  
  7.             type: 'POST',  
  8.             data: formData,  
  9.             contentType: false,  
  10.             processData: false,  
  11.             success: function (result) {  
  12.   
  13.             },  
  14.             error: function (result) {  
  15.   
  16.             }  
  17.         });  
//Below is the api
  1. [HttpPost]  
  2. [Route("api/document/uploads")]  
  3. public async Task<object> UploadDoc()  
  4. {  
  5. }

Answers (3)