1. #1
    Sencha User
    Join Date
    Jun 2008
    Posts
    229
    Vote Rating
    1
    sseema is on a distinguished road

      0  

    Default File Upload problem

    File Upload problem


    Hi,

    I am created one form in that i put one field as file for upload a file..
    For uploading a file we have to pass parameter that server can understands that it is file.


    Can any one please tell me what is that parameter?
    where can I add that one?

    My code....

    uploadFile = new Ext.form.TextField({
    fieldLabel: 'File',
    name: 'import',
    id:'import',
    inputType: 'file',
    readonly:true,
    width: 200
    });

    uploadform = new Ext.form.FormPanel({
    id:'upload_form',
    frame:'true',
    labelWidth:60,
    bodyStyle: 'padding: 10px 10px 0 10px;',
    //bodyStyle:'padding:10px 5px 25px 15px;',
    width: 500,
    autoScroll:true,
    labelAlign:'center',
    fileUpload : true,

    items:[
    uploadFile]
    }):

    I appreciate any help...


    Thank You...

  2. #2
    Ext User
    Join Date
    Jan 2009
    Posts
    24
    Vote Rating
    0
    veereshsh is on a distinguished road

      0  

    Default hi ssssssseeeeeeeema

    hi ssssssseeeeeeeema


    chek for the content type is multipart or not..if its file upload field its contenttype will be multipart
    and after ward get the attributes of the file upload field using
    ServletFileUpload fileUpload = new ServletFileUpload(new DiskFileItemFactory());
    items = fileUpload.parseRequest(request);
    Iterator iter=items.iterator();
    FileItem item = (FileItem)iter.next();
    and you item.getFieldName();item.get();item.getContentType() will help you

  3. #3
    Sencha User
    Join Date
    Jun 2008
    Posts
    229
    Vote Rating
    1
    sseema is on a distinguished road

      0  

    Default


    Hi, Thanks for your reply..

    How to set conetent type multipart to a field.

    Here I am sending value of a upload field to server.

    Thank You.

  4. #4
    Ext User shibubh's Avatar
    Join Date
    Jul 2007
    Location
    Lamahi,Dang Nepal
    Posts
    449
    Vote Rating
    0
    shibubh is on a distinguished road

      0  

    Default


    check this


    http://www.extjs.com/deploy/dev/exam...le-upload.html

    and then

    Code:
    var fp = new Ext.FormPanel({
      renderTo: 'fi-form',
      fileUpload: true,
      width: 500,
      frame: true,
      title: 'File Upload Form',
      autoHeight: true,
      bodyStyle: 'padding: 10px 10px 0 10px;',
      labelWidth: 50,
      defaults: {
        anchor: '95%',
        allowBlank: false,
        msgTarget: 'side'
      },
      items: [{
        xtype: 'textfield',
        fieldLabel: 'Name'
      },
      {
        xtype: 'fileuploadfield',
        id: 'form-file',
        emptyText: 'Select an image',
        fieldLabel: 'Photo',
        name: 'photo-path',
        buttonCfg: {
          text: '',
          iconCls: 'upload-icon'
        }
      }],
      buttons: [{
        text: 'Save',
        handler: function() {
          if (fp.getForm().isValid()) {
            fp.getForm().submit({
              url: 'file-upload.php',
              params: "IsFile=true",
              waitMsg: 'Uploading your photo...',
              success: function(fp, o) {
                msg('Success', 'Processed file "' + o.result.file + '" on the server');
              }
            });
          }
        }
      },
      {
        text: 'Reset',
        handler: function() {
          fp.getForm().reset();
        }
      }]
    });
    Shibu Bhattarai

    Use JavaScript beautifier to beautify you code http://jsbeautifier.org/

    Code Conventions http://javascript.crockford.com/code.html

    ExtJS Core Manual http://extjs.com/products/extcore/manual/

Thread Participants: 2