PDA

View Full Version : File upload to server from sometimes offline native app (Sencha cmd build)



tt88
16 Oct 2013, 4:10 AM
Hi

I am looking for a solution for uploading a file (image / document) to a server from a native app packaged with sencha cmd (not phonegap - I don't want to use phonegap so as to keep the web-based version + app version similar in this initial phase).

Here is an outline of the desired scenario:
- Native sencha app (android) takes a picture using the camera via a form field
- At some point in the future the contents of the form are pushed through to the server via an ajax call

So far I have the following:
- form element that can retrieve/store image data as a base64 string
- model representing the data of the form elements
- store that will push data to the server via an ajax proxy

My questions are the following:
1. Is storing the image data as a field in the model advisable - are there storage / space limitations? Would it be advisable to resize the image at this stage?
2. How could I convert the web version (Ext.field.FileInput) form data into a base64 image string?
3. How would I go about converting the base64 image in the app to an image on the server - would I do this in the app or on the server?
4. Is the above-mentioned scenario plausible & reasonable?

Thanks
-tt88