EXTJS文件上传 - 与IE8的安全栏问题 [英] EXTJS Fileupload - Problem with IE8 security bar

查看:109
本文介绍了EXTJS文件上传 - 与IE8的安全栏问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让一个ExtJS应用程序与附件发送电子邮件。所以,我有一个非常基本的形式,包括文本框为主体,另一个文本框与inputType:文件的附件,HTML编辑器

I'm trying to make an EXTJS application to send email with an attachment. So I have a very basic form that include textfield for the subject, another textfield with inputType: 'file' for the attachment, and an html editor.

var panel = new Ext.form.FormPanel({
    fileUpload:true,
    labelAlign: 'right',        
    monitorValid: true,
    border: false,
    bodyBorder: false,       
    defaults:{
        anchor: '100%',
        labelStyle: 'font-weight:bold;'
    },
    items: [
        {
            xtype: 'textfield',
            fieldLabel: 'SUBJECT',
            name: 'subject',
            allowBlank: false
        },
        {
            xtype: 'textfield',
            fieldLabel: 'ATTACHMENT',
            name: 'file_to_upload',
            anchor: '80%',
            itemCls: 'attachment-field',
            allowBlank: true,
            inputType:'file'
        },
        {
            xtype: 'htmleditor',
            fieldLabel:'MESSAGE',
            name:'msg'
        }
    ]
});

和这种形式被放置在一个窗口,将提交到服务器:

And this form is placed in a window which will submit to the server:

var window = new Ext.Window({
    title: 'Compose a message',
    height: 600,
    width: 800,
    autoScroll: true,
    border: false,
    bodyBorder: false,        
    items: panel,
    buttons:[
        {
            text: 'Send',
            formBind: true,
            handler: function() {
                panel.getForm().submit({
                    url: *Call to the server*,
                    method  : 'POST',
                    timeout: 300000, // 5min
                    waitMsg: 'Please wait while we send your email',                        
                    success :function(form, action) {
                        window.close();
                    }                                                
                });
            }
        },
        {
            text: 'Close',
            handler: function() {
                window.close();
            }
        }
    ]
});

和一切都很正常,当我提交表单使用FF服务器。但一个问题时与IE8。 IE浏览器显示安全条说,我想将文件下载到计算机上,而这正是扭转我在做什么(我上传的文件)!

And everything works great when I submit the form to the server using FF. But a problem occurs with IE8. IE is showing the security bar saying that I'm trying to download a file to the computer, which is exactly reverse of what I'm doing ( I'm uploading a file)!

我怎样才能prevent触发此安全吧?

How can I prevent triggering this security bar?

- 编辑2010年12月18日16:48 EST-- 是否有可能,它可以由此造成的:(从EXTJS basicForm文件正在添加)

--EDIT December 18th, 2010 16:48 EST-- Is it possible that it can be caused by this: (comming from the EXTJS basicForm documentation)

文件上传的,即它们在使用XMLHtt prequests不执行。代替在表单提交以标准方式用暂时修改成具有与其靶设置为引用一个动态生成的,隐藏的被插入到文档中,但去掉了返回数据已经收集后的DOM元素。服务器响应是由浏览器解析创建文档的IFRAME。如果服务器使用JSON发送返回的对象,那么Content-Type头必须是为了告诉浏览器插入文本不变到文档主体设置为text / html的。字符,这是显著为一个HTML解析器必须发送的HTML实体,所以EN code<如&其中;,&安培;作为与&等的响应文本从文档中检索,并创建一个假的XMLHtt prequest对象包含responseText属性,以顺应事件处理程序和回调的要求。请注意,文件上传数据包发送与内容类型多部分/形式和一些服务器技术(特别是JEE)可能需要一些自定义处理,以便从数据包内容检索参数名和参数值。

File uploads are not performed using normal 'Ajax' techniques, that is they are not performed using XMLHttpRequests. Instead the form is submitted in the standard manner with the DOM element temporarily modified to have its target set to refer to a dynamically generated, hidden which is inserted into the document but removed after the return data has been gathered. The server response is parsed by the browser to create the document for the IFRAME. If the server is using JSON to send the return object, then the Content-Type header must be set to "text/html" in order to tell the browser to insert the text unchanged into the document body. Characters which are significant to an HTML parser must be sent as HTML entities, so encode "<" as "<", "&" as "&" etc. The response text is retrieved from the document, and a fake XMLHttpRequest object is created containing a responseText property in order to conform to the requirements of event handlers and callbacks. Be aware that file upload packets are sent with the content type multipart/form and some server technologies (notably JEE) may require some custom processing in order to retrieve parameter names and parameter values from the packet content.

我不认为我了解一切关于存在的解释...

I don't think I understand everything about there explanation...

- 编辑完 -

-- END EDIT --

谢谢 阿兰·

推荐答案

这是外部写入文件。

<iframe id="ext-gen170" name="ext-gen170" class="x-hidden" src="about:blank"><html><head></head><body></body></html></iframe>  

此问题可以通过设置有效的HTTPS SRC路径,例如是决心 https://yousite.com/blank.html

This problem can be resolve by setting a valid https src path e.g. https://yousite.com/blank.html

我还没有找到如何修改SRC。任何帮助将受到欢迎。

I haven't found yet how to modify the src. Any help would be welcome

这篇关于EXTJS文件上传 - 与IE8的安全栏问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆