Hybrid View

  1. #1
    Ext JS Premium Member
    Join Date
    Jan 2010
    Location
    Italy
    Posts
    17
    Vote Rating
    0
    salgaf is on a distinguished road

      0  

    Default File Upload problem

    File Upload problem


    Hi,

    I'm trying to implement file upload in my web application.
    I have followed api documentation and used FileUploadField extension.
    Here is my code:
    Code:
            this.fieldUploadMan.add(new Ext.ux.form.FileUploadField({
                emptyText: 'Select .tar file',
                fieldLabel: 'File name',
                width:300
            }));
            
            this.fieldUploadMan.add({
          xtype: 'button',
          text: 'Upload',
          type: 'submit',
          width: 150,
                handler:function(){
                    this.panWebLct.getForm().submit({
                        url:'/goform/upldForm?applymode=on&savemode=on',
                        waitMsg: 'Uploading...',
                        success: function(form, action) {
                                Ext.Msg.alert('Success', action.result.msg);
                        },
                        failure: function(form, action){
                                Ext.Msg.alert('failure', action.failureType+ ' , '+ action.response+' , '+ action.result);
                        }
                    });
                }.createDelegate(this)
        });
    This is only a subset of my code:
    this=reference to Ext.Panel main container
    this.fieldUploadMan=reference to Ext.form.FieldSet
    this.panWebLct=reference to Ext.form.FormPanel

    The problem is that the server response is in HTM format as follows:
    Code:
    <html>
    <br><h1> MACHINE 192.168.74.30 NOT LOGGED </h1> <br>WEBS: upload DISCARD file "Webs_17_N96103_1.2.0b7.tar"  ( 1874 bytes ) <br>WEBS: accepted file: "webs_18_XXX.tar"  
    </html>
    When Ext try to decode the response fall in syntax error.
    There is any mode to avoid decoding the response because I don't need it.
    What I need is to get the HTTP response code, for example 200,500,506
    I can't modify the server response because is third part software.

    Sorry for my school Eglish

    Thank in advance

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    95
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    You could define a very simple error reader, e.g.
    Code:
    errorReader: {
      read: function(response){
        return {success: true}; // or false based on the response
      }
    }

  3. #3
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    56
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    The responseXML of the pseudo XHR passed to the reader should contain the HTML document.

    The reader should be able to make sense of it.

Similar Threads

  1. Problem with File Upload
    By merovius in forum Ext 3.x: Help & Discussion
    Replies: 4
    Last Post: 28 May 2011, 4:29 PM
  2. File Upload problem only with IE
    By mallempati in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 8 Mar 2010, 5:52 AM
  3. problem with upload a file
    By andryi in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 25 Aug 2009, 7:35 AM
  4. Problem Upload File
    By fraric in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 8 Jun 2009, 11:36 PM
  5. File Upload problem
    By sseema in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 8 Mar 2009, 10:15 PM

Thread Participants: 2