-
13 Apr 2009 8:39 AM #1
how to Reset Fileupload input?
how to Reset Fileupload input?
Hi There,
How do you reset file input value?? I have a dialog with a form and file input field. The first upload works, then open the dialog again the input text is the path of the old file. I can clear it out with setValue(''), but when I browse to a new file and try to upload, the first file gets uploaded.
And .setValue("") works in FF only in IE it says that does not support this object or property.
Can anyone help me , please???
Thanks
-
13 Apr 2009 11:06 AM #2
You need to delete and re-create it... At least that's what I did when I ran into this problem. a while back.
-
13 Apr 2009 11:21 AM #3
Hey
Thanks for your reply,
How did you delete and recreate it?
Could you give me sample code?
Thanks a lot
-
13 Apr 2009 11:29 AM #4
There are a bunch of ways, but you could do this every time you needed a new one:
Code:function buildFileInput() { if (this.fileInput) { delete(this.fileInput); } this.fileInput = new Ext.Component({ autoEl: { tag: 'input', type: 'file', name: 'fileinput' } }); }
-
13 Apr 2009 11:36 AM #5
i see. Thanks..
But thing is mine is not exactly file input..I am using fileuploadfield, and when i debug, i can see under it's properties, there is a fileInput property which still has the path of the file last time selected:
Any idea?Code:{ xtype: 'fileuploadfield', id: 'upload-file', emptyText: 'Select a file', fieldLabel: 'File Name', allowBlank: false, buttonCfg: { text: '', iconCls: 'upload-icon', id:'uploadbtn' }
-
13 Apr 2009 12:08 PM #6
I've never used the file upload field, but it looks like it's built with x-form-file-text (text field that displays the path) and x-form-file (the actual file input) and a button.
I'm not sure it would be the best way to do it, but I'd probably get the parent node of 'x-form-file' and call parentNode.replaceChild(file input dom obj,new file input dom obj); Someone else may be able to come up with a more 'Ext-ish' way of doing it though.
-
13 Apr 2009 1:16 PM #7
Hey
Thanks a lot for your reply,
Actually I found this thread:
https://extjs.com/forum/showthread.php?t=46716
And it solved my problem...
But thanks once again,
I appreciate it!!
-
12 Oct 2012 11:30 AM #8


Reply With Quote