question

BloomingDeveloper-9086 avatar image
0 Votes"
BloomingDeveloper-9086 asked BruceBarker-8516 answered

Drag and Drop files in Razor Pages

Hi ,

I want to drag and drop attachments to a form, where the attached files should list down with delete and view option. when i submit this form its should save the files to server. Any help would be appreciated.

Thanks !

dotnet-aspnet-core-razor
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @BloomingDeveloper-9086 , my idea on your requirement is that you can search for a good plug-in for your page. It will save time than trying to create one.

0 Votes 0 ·

1 Answer

BruceBarker-8516 avatar image
0 Votes"
BruceBarker-8516 answered

What you want to do must be done with JavaScript

https://www.smashingmagazine.com/2018/01/drag-drop-file-uploader-vanilla-js/
https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/File_drag_and_drop

Google for a lot more examples. One issues is the file list is read only, so you need a trick to implement the delete
.
https://stackoverflow.com/questions/3144419/how-do-i-remove-a-file-from-the-filelist

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.