405 method not allowed error for file upload in angularjs(IIS server)
<p>I have created upload functionality in angularjs and when I am trying to save the file in the folder I keep getting the error <code>405 method not allowed</code>. It's done locally on my IIS server.</p>

<p>controller file :</p>

<pre><code>.controller('fileuploadCtrl',  ['$scope','$route','$upload', function ($scope,$route,$upload) { 

    $scope.upload = function (files) {
        if (files &amp;&amp; files.length) {
            for (var i = 0; i &lt; files.length; i++) {
                var file = files[i];
                //var path = 'temp/files/' + $scope.information.id + '-' + file.name;
                var path = 'temp/files';
                $upload.upload({
                    url: path,
                    file: file,
                    fields: {
                        'username': $scope.username
                    },
                    headers: { 'Content-Type': 'multipart/form-data' }
                }).progress(function (evt) {
                    var progressPercentage = parseInt(100.0 * evt.loaded / evt.total);

                    $scope.percentComplete = progressPercentage;
                    $scope.items.attachment = evt.config.file.name;

                }).success(function (data, status, headers, config) {

                }).error(function (data, status, headers, config) {

                });
            }
        }
    };

}]);
</code></pre>

<p>HTML file :</p>

<pre><code>&lt;input type="file" ng-file-select name="file" ng-file-change="upload($files)"  &gt;
&lt;div class="progress" style=" margin: 0%"&gt;
    &lt;div class="progress-bar" role="progressbar" ng-style="{ 'width': percentComplete + '%' }" style="width: 0%;"&gt;
        &lt;span ng-if="percentComplete === 100"&gt;{{items.attachment}} upload completed successfully&lt;/span&gt;
    &lt;/div&gt;
    &lt;span ng-if="percentComplete &gt; 0" class="fileupload"&gt;{{percentComplete}}%&lt;/span&gt;
 &lt;/div&gt;
</code></pre>

<p><a href="https://i.stack.imgur.com/p56Jg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/p56Jg.png" alt="Screenshot given below"></a></p>