Closed kapeeeek closed 6 years ago
hi, I've got a new problem with my ng-file-upload app. I am creating email sender with attachment (angularJS + Java Spring).
Js code:
$scope.uploadFiles = function (event) { $scope.file = event.target.files[0]; };
$scope.sendEmailAttachment= function(){ $scope.emailData = new EmailData(); $scope.emailData.to = "sample1@gmail.com"; $scope.emailData.from = "sample2@gmail.com"; $scope.emailData.subject = "My subject"; $scope.emailData.type = "ERROR"; $scope.emailData.title = $scope.data.topic; $scope.emailData.description = $scope.data.description; $scope.emailData.template = "templateSender"; Upload.upload({ method : 'POST', url : 'sendemail/attachment', headers: { 'Content-Type': undefined }, data : $scope.emailData, file : $scope.file }).success(function(response) { console.log("Success"); }).error(function(error) { console.log("Error"); }); }
My java controller:
@RequestMapping(value = "/attachment", method = RequestMethod.POST) public EmailStatus sendEmailAttach(@RequestBody EmailData emailData, @RequestParam("file") MultipartFile file) { return emailSenderAttachment.sendDataAttach(emailData, file); }
I've got error:
"status":415,"error":"Unsupported Media Type" "Content type 'multipart/form-data;boundary=----WebKitFormBoundaryDjCedKgOWbfrh1lb;charset=UTF-8' not supported"
"status":415,"error":"Unsupported Media Type"
"Content type 'multipart/form-data;boundary=----WebKitFormBoundaryDjCedKgOWbfrh1lb;charset=UTF-8' not supported"
Someone can help me?
Never mind, sorry but I resolved it :D
i am getting same issue how did you fix it?
hi, I've got a new problem with my ng-file-upload app. I am creating email sender with attachment (angularJS + Java Spring).
Js code:
My java controller:
I've got error:
Someone can help me?