Drag file from browser window into software
Asked Answered
D

1

6

Is there a way to drag a file from a custom made webpage, hosted on a local maching, onto a piece of software?

Example use:

For the sake of the question, I want to drag an .mb file from an html library I have created onto Maya. Ideally this will act as if I have dragged a file from finder or windows explorer. I know you can drag and drop onto a browser using HTML5 but I am trying to achieve the reverse.

Any suggestions would be greatly appreciated.

Regards

Ducan answered 29/11, 2016 at 10:4 Comment(1)
Are you downloading it first?Beckwith
G
6

Yes, it is possible. you can go through this link which has explained how to achieve drag and drop from Browser to desktop in details.

The solution only works with Chrome browser as Google has extended the ability to drag out attachments to your file system. (Probably for their Google drive)

It can be achieved by calling "ondragstart" event like the code below on the file that you wish to be dragged from Browser to the client machine:

        var file = document.getElementById("dragout");

        file.addEventListener("dragstart",function(evt){
        evt.dataTransfer.setData("DownloadURL",fileDetails);
        },false);
Gilbertegilbertian answered 29/11, 2016 at 10:7 Comment(2)
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.Convolvulus
@RoryMcCrossan, Thanks Rory for your comment. I totally agree with you. I will extract the main part of this article and include it in my answer now.Gilbertegilbertian

© 2022 - 2024 — McMap. All rights reserved.