javascript 用于 Internet Explorer 的拖放文件上传库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10173830/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 08:55:04  来源:igfitidea点击:

Drag and drop file upload library for Internet Explorer

javascriptinternet-explorer

提问by plang

I found a great library called JQuery File Uploadfor drag-and-drop files uploads in modern browsers. Unfortunately drag-and-drop does not work in Internet Explorer.

我发现了一个很棒的库,叫做JQuery 文件上传,用于在现代浏览器中拖放文件上传。不幸的是,拖放在 Internet Explorer 中不起作用。

Drag-and-drop file upload in IE is a requirement of the project, so I'd like to find a solution for this specific situation. My idea is to end up with two versions of the upload page, one for IE, and another one for the rest of the world.

IE中拖放文件上传是项目的需求,所以我想针对这种特定情况找到解决方案。我的想法是最终得到两个版本的上传页面,一个用于 IE,另一个用于世界其他地方。

Does anyone know a good activex library for such uploads in IE, that does not require any installation?

有谁知道在 IE 中进行此类上传的一个好的 activex 库,它不需要任何安装?

回答by MyBoon

I think that the best way is to use the new HTML5 Drag and Drop API and new File API.

我认为最好的方法是使用新的 HTML5 Drag and Drop API 和新的 File API。

回答by Nicolas S.Xu

you can try dropZone, support IE 10+

你可以试试dropZone,支持 IE 10+

回答by saji89

FiledropJS 2, is a drag and drop file upload library, which has an <Iframe>based fallbackfor working in older IE's as well. There is a demo in that page. It looks promising, check it out.

FiledropJS 2是一个拖放文件上传库,它也有一个用于旧 IE 的回退。该页面中有一个演示。看起来很有希望,检查一下。<Iframe>

回答by B T

I wrote a javascript module to do generalized drag and drop events including:

我编写了一个 javascript 模块来执行通用的拖放事件,包括:

  • file dropping,
  • drag and drop within a browser window,
  • drag and drop between two different browser windows,
  • drag and drop from a browser window to an external application, and
  • drag and drop from an external application to a browser window
  • 文件掉落,
  • 在浏览器窗口中拖放,
  • 在两个不同的浏览器窗口之间拖放,
  • 从浏览器窗口拖放到外部应用程序,以及
  • 从外部应用程序拖放到浏览器窗口

It abstracts away a bunch of bizzaro things about the html5 drag and drop api that would otherwise waste hours of your time. Here's an example usage:

它抽象了一堆关于 html5 拖放 api 的奇怪的东西,否则会浪费你几个小时的时间。这是一个示例用法:

dd.drag(myDomNode, {
    dragImage: true, // default drag image
    start: function(setData, e) {
        setData('myCustomData', JSON.stringify({a:1, b:"NOT THE BEES"})) // camel case types are allowed!*
    }
})
dd.drop(myDropzone, {
    drop: function(data, pointer, e) {
        myDropzone.innerHTML = data.myCustomData
    }
})

It works in IE as well (with the usual IE caveats). Check out the full documentation here: https://github.com/fresheneesz/drip-drop

它也适用于 IE(带有通常的 IE 警告)。在此处查看完整文档:https: //github.com/fresheneesz/drip-drop