An open API service indexing awesome lists of open source software.

https://github.com/vndevpro/dropzonemvc

An easy file upload handler in ASP.NET MVC with DropzoneJS
https://github.com/vndevpro/dropzonemvc

Last synced: 9 months ago
JSON representation

An easy file upload handler in ASP.NET MVC with DropzoneJS

Awesome Lists containing this project

README

          

# DropzoneMvc
MVC controller and file upload handling in ASP.NET MVC
(https://www.nuget.org/packages/DropzoneMvc/)

# Steps to install it on your MVC App

1. Put into web.config the below keys in AppSettings (this will be used by DropzoneAttachmentController)

```


```

2. Install the package into your app:

Install-Package DropzoneMvc

3. In your view (the form) add the following

@{
Html.RenderAction("GetComponent", "DropzoneAttachment", new { referenceId = Model.Id });
}

4. In POST action of the controller

var tempFilesFolder = Server.MapPath(ConfigurationManager.AppSettings["TempFilesRoot"]);
var files = new DropzoneMonitor(Request).GetActiveUploadedFiles(tempFilesFolder);
// file will be the full path minis the TempFilesRoot

Now you get all the files, just save them as your logic requires.

Please check some notes below:

/!\ JQuery must be configured & put in head tag

/!\ Dropzone js and css bundles must be declared (in BundleConfig.cs file) -> these bundles will be referenced by the view _DropzoneComponent.cshtml (in **DropzoneMvcDemo\Views\Shared**)

/!\ You must have to config an IoC for IDropzoneAttachmentSecurityCheck => Check the demo setup with SimpleInjector