是否可以取消使用隐藏iframe的文件上传?

Ale*_*rov 10 ajax iframe upload file-upload

是否可以取消使用隐藏iframe的文件上传?

我试图将iframe的源设置为空字符串,但上传没有被中断.

Ste*_*ura 8

iframe是承载表单发布的传输通道,因此Atanas是正确的,您必须停止iframe内的传输.

这是一种根据浏览器执行此操作的方法:

if (iframeObj.contentWindow.document.execCommand)
    { // IE browsers
        iframeObj.contentWindow.document.execCommand('Stop');
    }
else
    { // other browsers
        iframeObj.contentWindow.stop();
    }
// notify user upload was cancelled, remove spinner images, etc
Run Code Online (Sandbox Code Playgroud)