Hie i am developing a Simple Sencha App on Sench touch 2..3 version and CMD 4 and in my app i have form which has got different fields including a file upload field where by the data from the field is sent to the server.But i have got a problem when i test the app by native apk in my android phone(API level 16) the file upload field is not working. I search lots of links but couldn't find the solution ...is the file upload is not supported in sencha touch 2.3 native apk?
I am posting my form.js here
Form.js
Code:
Ext.define('Test.view.Contact',{
extend: 'Ext.form.Panel',
xtype: 'contactform',
requires: [
'Ext.form.FieldSet',
'Ext.field.Email',
'Ext.field.File',
'Ext.ProgressIndicator',
'Ext.device.filesystem.Sencha'
],
config:{
progress: function(e) {
loadingText: "Uploading: {percent}%";
},
//Progress can also be a simple callback
progress: function(e) {
console.log((e.loaded / e.total) * 100);
},
title: 'Contact',
iconCls: 'user',
xhr2: true,
progress:true,
xtype: 'formpanel',
url: 'http://xyz.net/contact-test.php',
layout: 'vbox',
items: [
{
docked: 'top',
xtype: 'titlebar',
title: 'Enquiry'
},
{
xtype: 'fieldset',
title: 'Contact Us',
instructions: '(email is not required)',
items: [
{
xtype: 'textfield',
name: 'Name',
label: 'Name'
},
{
xtype: 'emailfield',
name: 'Email',
label: 'Email'
},
{
xtype: 'textareafield',
name: 'Message',
label: 'Message'
},
{
xtype:"filefield",
label: "Select image(s):",
name: "photos",
accept:"image/jpeg",
multiple: true
}
]
},
{
xtype: 'button',
text: 'Send',
ui: 'confirm',
handler: function() {
//Ext.Viewport.add(progressIndicator);
// var form = Ext.Viewport.down("formpanel");
var input = Ext.Viewport.down("filefield").getComponent().input;
var files = input.dom.files;
for(var i = 0 ; i<files.length ; i++){
var file = files[i];
if(file.size > 2097152) {
Ext.Msg.alert("JPG Must be less then 2MB");
return;
}
}
this.up('contactform').submit();
}
}
]
}
});