2

I am new to ASP.NET MVC and AngularJS, How can I Upload file (Image/PDF/Doc) to server Folder By AngularJS Controller with ASP.NET MVC Controller

1 Answer 1

3

you can use the angular-file-upload first install it:

bower install bower install angular-file-upload

then add it as dependency in your app.

angular.module('your-app-name', ['angularFileUpload']);

In your controller, inject the FileUploader service:

angular.module('your-app-name').controller('ctrlName',
      ['$scope','FileUploader', function($scope, FileUploader) {
       $scope.uploader = new FileUploader({
                           url: 'server_url_here'
                   //you can add other configuration here like xsrf headers  
          });
      }]);

Then in your html:

               Multiple
                <input type="file" nv-file-select="" uploader="uploader" multiple  /><br/>

                Single
                <input type="file" nv-file-select="" uploader="uploader" />

You can find a detailed explanation here: https://github.com/nervgh/angular-file-upload An example: https://github.com/nervgh/angular-file-upload/tree/master/examples/simple

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for response, Can you help me with ASP.NET MVC Controller also please
Hi, sorry for the late reply...may be i can guide you to a good resource/expert, he has explained very well on integrating angular with asp.net as well as best practices to follow. Check this link: www.bradoncode.com/blog/2012/11/the-code-review-aspnet-10-years-on-2.html

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.