Gui*_*Gui 3 extjs file-upload filefield
我使用的是ExtJS 4.1.1版.
我尝试使用filefield创建上传文件格式如下:
{
xtype: 'filefield',
itemId : 'my-file',
name: 'my file',
emptyText : 'No file chosen',
fieldLabel: 'Upload File',
submitValue: true,
allowBlank : false,
buttonText: 'Browse',
listeners: {
change: function(fld, value) {
var newValue = value.replace(/C:\\fakepath\\/g, '');
fld.setRawValue(newValue);
}
}
}
Run Code Online (Sandbox Code Playgroud)
提交表单后,将filefield
重置.
正如我在http://www.sencha.com/forum/showthread.php?135109-File-upload-field-is-empty-by-re-submitting-of-the-form中看到的那样
我试图覆盖filefield
到:
Ext.override(Ext.form.field.File, {
extractFileInput: function() {
var me = this,
fileInput = me.fileInputEl.dom,
clone = fileInput.cloneNode(true);
fileInput.parentNode.replaceChild(clone, fileInput);
me.fileInputEl = Ext.get(clone);
me.fileInputEl.on({
scope: me,
change: me.onFileChange
});
return fileInput;
}
Run Code Online (Sandbox Code Playgroud)
提交表单时看起来不错.
我在文本字段中看到的值不会重置为空.
但是,当我再次提交表单而不重新选择文件时,发送到服务器的数据为空.
应保留发送到服务器的数据.
附加信息:
当我使用Chrome和IE时出现此问题,它似乎在Firefox上工作正常.
它与C:\\fakepath
我在文本字段中看到的选择文件时有关吗?
我该如何解决这个问题?
归档时间: |
|
查看次数: |
3723 次 |
最近记录: |