Ticket T562006
Visible to All Users

FileUploader doesn't support drag & drop in IE and Edge if uploadMode is useForm

created 8 years ago

Drag & drop doesn't work in Edge browser if uploadMode=useForm. Switching uploadMode to other value make drag & drop working. Please refer plunker example. Is this a bug?

Comments (1)
DevExpress Support Team 8 years ago

    Hello Denis,

    Thank you for providing us with the online example. I have reproduced the issue and passed this ticket to our developers for further research.

    Answers approved by DevExpress Support

    created 8 years ago (modified 8 years ago)

    Hello Denis,

    Our developers have researched the issue and found out that it is related to IE directly: Input type=file" drag-and-drop IE
    So, I am afraid we cannot fix the issue at the level of our widgets. I suggest you choose another uploadMode if you need to drag and drop in IE.

    You can read more about this in the following thread:

    T525318: dxFileUploader doesn't support drag & drop in IE 11 if uploadMode is useForm
    Here is an online example:
    https://jsfiddle.net/5ub6feza/

    JavaScript
    function dropHandler(event) { doNothing(event); var filelist = event.dataTransfer.files; if (!filelist) return; // if null, exit now var filecount = filelist.length; // get number of dropped files if (filecount > 0) { var fileInput = $("#file").dxFileUploader("instance"); fileInput.option("value", [event.dataTransfer.files[0]]); var dropText = document.getElementById("dropText"); dropText.style.display = "none"; } } function doNothing(event) { event.stopPropagation(); event.preventDefault(); } $("#file").dxFileUploader({ uploadMode: 'useForm', onContentReady: function() { var dropArea = document.getElementById("dropContainer"); dropArea.addEventListener("drop", dropHandler, false); dropArea.addEventListener("dragover", doNothing, false); } })
    CSS
    .dx-fileuploader-input-label { visibility: hidden } .dx-fileuploader{ width: 120px; float: left; } #dropText{ padding-top: 23px; } #dropContainer{ border:1px solid black; height:170px; }
      Show previous comments (10)

        Please follow this Plunker example to see how drag&drop can work in Edge in your FileUploader component

        DevExpress Support Team 7 years ago

          Denis,

          I do not see the <form> element in your example. The "useForm" upload mode requires the form. If it is absent, it is possible that you do not need the "useForm" upload mode. Would you please clarify this.

          I have also attached a project with a screencast that illustrates that sending the uploaded data does not work with custom dragging. Please check it.

          SG SG
          Sven Glöckner 7 years ago

            I also made some research on the possibilities with file upload and Drag&Drop.

            Please allow me to add some comments.
            While it's true that in the meantime Microsofts Edge browser is capable of Drag&Drop to insert files in a web site with some JavaScript code. But nevertheless it's impossible to submit those files through a web form to the server by using the simple input type file.
            What I've found out so far is that this restriction is for security reasons. The file collection of the input element is read-only.
            While other browsers may support this feature (like Chrome or Firefox) - Edge and IE do not.

            Denis' sample is very good but it only shows how to implement Dragging files in a web page. The files are not sent to the server. The only way to the upload is by using Ajax calls.

            But I didn't want to use Ajax because of the user experience. I'd like to submit any attachments along with the form submit and save everything together. From the user's perspective it's not very intuitive to click two buttons - one for entered data and the other to upload files.  So I ended up to not support Drag&Drop.

            Regards
            Sven

            Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

            Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.