Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Cannot send excel file to server, asp.net doesn't see any files.IFormFile is null in API

$
0
0

on client-side: Uploading excel file. 

<div> <form> <div> <label for="myFileField">Select a file: </label> <input type="file" demo-file-model="myFile" class="form-control" id="myFileField" /> </div> <button ng-click="uploadFile()" class="btn btn-primary">Upload File</button> </form> </div>

angular controller:

$scope.uploadFile =function(){var file =$scope.myFile;Service.fileUploadAll(file,function(response){});


fileUploadAll(file){var fileFormData =newFormData();
        fileFormData.append('file', file);returnthis.promiser.post('/api/fileUpload', fileFormData);

}

[HttpPost("fileUpload")]publicIActionResult fileUploadAll(IFormFile file){
// Do some
}

I'm working on Asp.NET Core . Please help me to resolve this issue.


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>