PDA

View Full Version : [CLOSED] [#92] FileUpload



Timothy
May 07, 2012, 6:14 PM
Hello,

Anyway to make a FileUpload field not clear it's selected file out after upload? I'm returning an error message over direct event, and once the error message is received the user has to select the file for upload again to correct it.

Any suggestions?

Cheers,
Timothy

Timothy
May 07, 2012, 9:03 PM
Ooops, edited the wrong post.

Daniil
May 08, 2012, 10:39 AM
Hi Timothy,

You can override this behavior by the following way.

Example

<ext:ResourcePlaceHolder runat="server" Mode="ScriptFiles" />

<script type="text/javascript">
Ext.form.field.File.override({
extractFileInput: function() {
var fileInput = this.fileInputEl.dom;
//this.reset();
return fileInput;
}
});
</script>

But you will have to call the reset method yourself to let a user to choose a new file.

Daniil
May 08, 2012, 11:02 AM
I've started the related thread on Sencha.
http://www.sencha.com/forum/showthread.php?202912

Daniil
Aug 28, 2012, 5:25 AM
Sencha says they have an opened ticket for this case. I will monitor.
http://www.sencha.com/forum/showthread.php?239572

Daniil
Dec 27, 2012, 5:37 AM
Opened an Issue to track this defect, see:
https://github.com/extnet/Ext.NET/issues/92

Daniil
Jan 15, 2013, 4:00 AM
Added the ClearOnSubmit property for FileUploadField (trunk, v2.2).

Thank you again for the report.

bogc
Jan 15, 2013, 7:56 PM
I know this has been fixed in 4.2.

I just wanted to say that, for those still on Ext.net 2.1.1/ ExtJs 4.1.1, the patch provided in this thread leads to another weird behavior. The file name is not cleared but after you submit, clicking on the button to select another file doesn't do anything, it doesn't open the file dialog.

For now, I will just live with the field being reset.

Daniil
Jan 16, 2013, 3:44 AM
Thank you for the update!

Probably, it is why ExtJS team decided to reset a file field and then restore.