I have an html upload form and an angular controller controlling it. In the controller, I found out how to get the files uploaded but my question is how can I move/upload these files to the server? I checked out multer but I don't believe this is going to work in my case because I can't require it in the client-side. Here is what my controller currently looks like:
app.controller('uploadCtrl', function($scope, $location, $http){
$scope.enableSubmitButton = false;
$scope.fileSizeError = false;
var selectedFiles = [];
//get files selected
$scope.getFiles = function($files){
selectedFiles = $files;
//display upload button if there is a valid file to upload
if(selectedFiles.length !== 0){
$scope.enableSubmitButton = true;
}
}
$scope.upload = function(){
if($scope.enableSubmitButton){
//disable to prevent clicking again
$scope.enableSubmitButton = false;
//correctly shows the file data
console.dir(selectedFiles);
//upload files to server
//What should I do here?
}
}
});