Results 1 to 2 of 2

Thread: file upload cannot handle well both failure and success

    Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Touch Premium Member
    Join Date
    Aug 2010
    Posts
    104

    Default file upload cannot handle well both failure and success

    A problem in Ext JS 4.2.2 doing file upload (observed with Ext Direct) is:

    If you leave the default or clearOnSubmit:true then on failure (and on success) it clears the file field (and user has to select again to try again).

    If however you set clearOnSubmit:false then neither on failure nor on success it clears. That seems OK. But ... if you think you'd in your success:function call form.reset() it doesn't clear, because it looks at the clearOnSubmit.

    Which means the user by mistake might submit the same file a second time. Pain!

    Me thinks part of a solution should be two separate functions in Ext.form.field.File:

    One reset() function that works at any time, like all field reset().

    Another function that does whatever is necessary for the special treatment for submit.

    Specifically I see class Ext.form.action.DirectSubmit method doSubmit call class Ext.form.action.Submit method buildForm call class Ext.form.field.File method extractFileInput call class Ext.form.field.File method reset.

    It is that Ext.form.field.File reset function that doesn't clear if clearOnSubmit:false.

    Possibly that code should live (as a copy) in the extractFileInput function, and then the reset function could be simplified and actually work for application code to use in success.

    This problem seems to be a consequence of work done around http://www.sencha.com/forum/showthread.php?239572 .

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985

    Default

    Thanks for the report! I don't think this is a bug. It seems to be working as it was intended, especially if developers check the setting on reset. That said, I have opened a Feature Request in our tracker so this issue is considered.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •