简体   繁体   中英

Drag and Drop Files to Html Input

I have an html dropdown input and upload button which works as i want but i want the ability to drag files from my computer on to a dropzone and then upload.

How can i do this?

<input id="FileUpload" type="file" accept=".doc, .docx, .ppt, .pptx, .xls, .xlsx, .pdf, .jpg, .jpeg, .png, .gif" multiple="multiple" onchange="CheckFileSize();" />

<asp:Button ID="FileUploadBtn" runat="server" Text="Upload" OnClientClick="return ValidateAndSend('Upload');" />

I have the below doctype that i cant change, i believe this means i cant use html5 examples

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

I believe that HTML Input does not have a drag and drop file input. You should consider importing an external script such as Dropzone.js .

All you have to do is download and import the js file into your html and follow the instructions on the website t create a drag and drop file input. The Doctype heading shouldn't affect this method.

I hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM