How to upload multiple files in MVC to database?

182 views Asked by At

Right now in my code , I can only add image to my project inside image folder. I want to add multiple files with drag and drop and save them in a file inside my project. I tried to use Uppy File Uploader but I can't connect it to my attribute. Is there anything else I can use in my project as a File Uploader ?

 <form method="post" asp-action="create" id="form2" enctype="multipart/form-data">


      
        <div class="form-group">
            <label asp-for="ImageUrl">@localizer.GetLocalizedHtmlString("ImageUrl")</label>
            <div id="drag-drop-area">

            <input asp-for="ImageUrl" type="file" name="file" class="form-control" id="ImageUrl"/>

            </div>

            <script type="module">
                import { Uppy, Dashboard, Tus } from "https://releases.transloadit.com/uppy/v3.0.1/uppy.min.mjs"
                var uppy = new Uppy()
                    .use(Dashboard, {
                        inline: true,
                        target: '#drag-drop-area'
                    })
                    .use(Tus, { endpoint: 'https://tusd.tusdemo.net/files/' })

                uppy.on('complete', (result) => {
                    console.log('Upload complete! We’ve uploaded these files:', result.successful)
                })
            </script>
          
            </div>
</form>
0

There are 0 answers