1. #1
    Sencha User
    Join Date
    Jan 2013
    Posts
    1
    Vote Rating
    0
    sudhakar06 is on a distinguished road

      0  

    Default File Upload Problem

    File Upload Problem


    Hi,

    I am in new sencha touch developer. when i am try to file upload by this below code

    <link rel="stylesheet" href="resources/css/sencha-touch.css" type="text/css">
    <script type="text/javascript" src="resources/sencha-touch-debug-w-comments.js"></script>

    app.views.addphoto.Form = Ext.extend(Ext.form.FormPanel, {
    height: 457,
    width: 279,
    initComponent: function () {
    Ext.regModel('Contact', {
    fields: ['silver', 'cover', 'delete']
    });
    var store = new Ext.data.JsonStore({
    model: 'Contact',
    sorters: 'delete',
    getGroupString: function (record) {
    return record.get('delete')[0];
    },
    data: [{
    silver: 'silver.png',
    cover: 'hyphen.png',
    delete: 'delete.png'
    }, {
    silver: 'horse.png',
    cover: 'ok.png',
    delete: 'delete.png'
    }, {
    silver: 'silver.png',
    cover: 'hyphen.png',
    delete: 'delete.png'
    }]});
    /*Ext.apply(app.views, {
    myhorseFieldset: new app.views.myhorse.Fieldset()
    });*/
    Ext.apply(this, {
    id: 'formid',
    defaultType: 'textfield',
    fileUpload: true,
    method: 'post',
    frame: true,
    isUpload: true,
    items: [{
    xtype: 'panel',
    margin: '20 0 0 0',
    title: 'Add Horses',
    id: 'titlealign',
    centered: 'true',
    cls: 'addhorse',
    items: [{
    docked: 'top',
    xtype: 'toolbar',
    title: 'Add Horses',
    ui: 'light',
    html: '<div style="float:right; padding-top:8px;"><img src="resources/images/dots2s.png" ></div>',
    cls: 'addhorse',
    }, {
    xtype: 'container',
    flex: 2,
    padding: '0 auto',
    html: '<img src="resources/images/silver.png" width="114" height="114" />',
    }, {
    fieldLabel: 'Upload',
    id: 'uploadid',
    xtype: 'textfield',
    name: 'file',
    inputType: 'file',
    allowBlank: false,
    disabled: false,
    },
    /*{
    xtype: 'button',
    html: '+&nbsp;&nbsp;PHOTO',
    margin:'0 0 0 83px;',
    padding:'0 10px',
    width:'110',
    handler: function () {
    //window.location = '#addhorse';
    }
    },*/
    {
    xtype: 'panel',
    flex: 2,
    html: '<hr>',
    margin: '0 auto',
    padding: '0 15px'
    }, {
    xtype: 'panel',
    flex: 2,
    ui: 'light',
    id: 'photopanel',
    html: '<div><span class="name" >Name</span> <span class="cover">Cover</span> <span class="delete">Delete</span></div>',
    },
    {
    hideOnMaskTap: true,
    centered: true,
    hideOnMaskTap: true,
    width: '15em',
    height: '8em',
    scroll: 'vertical',
    xtype: "list",
    itemTpl: '<div><span class="imgfile">{silver}</span> <span class="covercheck"> <img src="resources/images/{cover}" /></span> <span class="deletefile"><img src="resources/images/{delete}"/></span></div>',
    ui: 'none',
    style: 'background:none',
    grouped: false,
    indexBar: false,
    store: store
    }, {
    xtype: 'button',
    text: 'Next',
    scope: this,
    handler: function (b, e) {
    //var form = Ext.getCmp('formid');
    var form = Ext.getCmp("formid");
    form.submit({
    url: app.config.url.horseUploadResponse,
    method: 'POST',
    success: function (frm, res) {
    alert('Form submitted: ' + res.success);
    },
    failure: function (frm, res) {
    alert('Form no submit!');
    }
    });}}]
    }]
    });
    app.views.addphoto.Form.superclass.initComponent.apply(this, arguments);
    },
    render: function () {
    app.views.addphoto.Form.superclass.render.apply(this, arguments);
    }});

    Please can someone help for me.
    Thanks

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    34,107
    Vote Rating
    453
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    You say you are a new Sencha Touch developer but are posting in Ext JS 3 Help forum. Which are you using?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.