dimanche 12 avril 2015

uploading doc using angularjs and spring mvc on IE8

I implemented a functionality to upload docs and form data using angularjs + spring mvc on my module. It is working fine. Now people are expecting the same app to run on IE8. IE8 is not supporting FormData. I removed it and created plain json object to transfer data. I am facing 500 error saying "the request was rejected because no multipart boundary was found"


Ajax call code



var attachmentType = {};
attachmentType = $scope.uploadFile0;

var raiseServiceRequest = {};
raiseServiceRequest.comments=$scope.comments,
raiseServiceRequest.summary=$scope.summary,
raiseServiceRequest.attachments=attachmentType;

$http.post("./testTicket",raiseServiceRequest,{headers: {'Content-Type': 'multipart/form-data'}})
.success(function(data){
if(data.responseStatus==true){
window.location.href = "./showTicketDetails?coltReference="+data.data[1]+"&isNew=true";
}else{
$scope.submitTicketStatus = false;
$scope.blur = 1;
console.log(data.responseMessage);
$scope.displayProblem=true;
$scope.problem="Error in raising incident ticket";
}
})
.error(function(data){
$scope.submitTicketStatus = false;
$scope.blur = 1;
console.log(data.responseMessage);
$scope.displayProblem=true;
$scope.problem="Error in raising incident ticket";
});
};


Controller code



@RequestMapping(value = "/testTicket", method = RequestMethod.POST)
public @ResponseBody CommonResponse createIncidentTickets(RaiseServiceRequestDto raiseServiceRequest,HttpServletRequest request,HttpServletResponse response) {

CommonResponse commonResponse = new CommonResponse();
commonResponse.setResponseStatus(true);
return commonResponse;
}


I need some good support on this guys. Thanks in advance.


Aucun commentaire:

Enregistrer un commentaire