angular-file-upload icon indicating copy to clipboard operation
angular-file-upload copied to clipboard

Upload file to folder in ASP MVC

Open LenWhims opened this issue 8 years ago • 0 comments

I'm using the simple sample but the upload code was in php, I could not find a sample in asp mvc. So far this is all I have:

script.js

var uploader = $scope.uploader = new FileUploader({
                scope: $scope,
                url: '/Files/UploadFile'
            });

FilesController.cs I'm gonna save the path to db so below is what I need but for the upload to folder part I have no clue what to call or how.

[HttpPost]
        public JsonResult UploadFile([Bind(Include = "Id,Name,Path,RecipeId")] List<File> vm)
        {

            foreach (var file in vm)
            {
                File recipefile = new File();
                recipefile.Name = file.Name;
                recipefile.Path = file.Path;
                recipefile.RecipeId = file.RecipeId;
                db.Files.Add(recipefile);
            }
            return Json("File uploaded successfully");

        }

I hope someone could help me. Thanks!

LenWhims avatar Jan 15 '18 02:01 LenWhims