Upload file without using Multi Part form data using AngularJS
Posted By : Rahul Sarkar | 10-Jan-2017
Here I am going to describe you that how to Upload file without using Multipart form data in AngularJS, if you are new in AngularJS and you don't have knowledge about Multipart form data then this blog will help you a lot, you can upload your file using these very few simple steps:
First of all you need to write you HTML view part using an input type file.
Now you have to write your AngularJS code to get the file data from your HTML page:
$scope.submitClientProfileDataCtrl = function() {
var formData = new FormData();
formData.append( 'attachment1', $scope.clientAttachment1);
// POST your data using http post method
$http({
method: "post",
url: '/clientProfile/getClientProfileDetails/.json',// enter your own url
data : formData,
transformRequest: angular.identity,
headers: {'Content-Type': undefined}
}).then(function(data) {
console.log("success data ", data);
},
function(data) {
console.log("error data ", data);
});
};
More From Oodles
Ready to innovate? Let's get in touch
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Rahul Sarkar
Rahul is an intellectual web app developer, he has good knowledge of C, Java, Java Script, Jquery. Apart from this he likes to travel and explore new places.