PDA

View Full Version : File Upload Problem



sudhakar06
21 Jan 2013, 2:42 AM
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

mitchellsimoens
23 Jan 2013, 11:02 AM
You say you are a new Sencha Touch developer but are posting in Ext JS 3 Help forum. Which are you using?