Sencha Touch is among the leading frameworks for designing mobile web applications and is famous among the web developers who build mobile web Apps.
Any mobile web App requires backend for hosting and saving its App data which is required by Sencha Touch Apps too. Your App data can be either binary (e.g. image/audio/video file) or non-binary plain text user and its related information (e.g. name, age, dob and any other information). App42 JS framework is equipped to deal with all of your data storage requirements including binary/non-binary data. For storing binary data like audio/video/image files App42 has CDN service in which all of your App files will be uploaded on our CDN network and can be accessed from its unique http end point URL.
If you are developing a mobile web App with Sencha Touch using App42 JS SDK, and your App requires a file to be uploaded on the server and accessible through http url, you have landed on the right place. All you have to do is to follow the below mentioned steps and your app would be enabled with CDN power which will give your app user a good experience of multimedia data surfing.
1. Register with App42 platform.
2. Go to the dashboard and click on the Create App button.
3. Fill all the mandatory fields and get your APIKey and SecretKey.
4. Download App42 Java Script sample app and unzip it on your machine .
5. Edit index.html file and put your APIKey and SecretKey (which were received in step#2 & #3) as shown below:
App42.initialize("Your APIKey","Your SecretKey");
Upload file using App42:
1. Add required statement in your sencha touch view part.
requires: ['Ext.field.File']
2. Add file tag in your view part child items.
xtype: 'file',
name: 'fileId'
3. Upload file using App42
var filePath = document.getElementsByName("fileId"),
file = filePath[0].files[0],
upload = new App42Upload(),
name = "image name",
userName = "Nick"
fileType = "IMAGE",
description = "image description";
upload.uploadFileForUser(name,userName,file, fileType,description,{
success: function(object) {
var uploadObj = JSON.parse(object)
var getData = uploadObj.app42.response.upload.files.file
// do your code....
},
error: function(error) {
// do your code....
console.log("error is: " + error)
}
});
That’s it. You are done with the integration and your Sencha Touch App is now enabled with App42 backend services.
If you have any questions or need further assistance to integrate this in your App, please feel free to write us at support@shephertz.com
Leave A Reply