View Full Version : Implementing a file picker in Sencha Touch

22 Jul 2012, 1:06 PM
Hello, everyone!

The question is about file picker. For a great surprise I can't find posts or articles or even questions about file browsing in Sencha touch applications.
In many applications there is a need for selecting image or another type file from the device directories, for example, from the captured images folder.

Is there a component in Sencha touch that provides the functionality to pick a file from the file system?

22 Jul 2012, 11:41 PM
To my knowledge there isn't.

The way we solved this in our app was to include an <input type=file> directly in the panel, and to upload the form via a traditional form POST action instead of via Ext.Ajax.request. The target for the <form> tag was set to a hidden iframe, and when the iframe's content changes, we parse it to get the server output back.

It's really ugly. It's also the same thing ExtJS does to do file uploads behind the scenes.

Also, don't forget that in iOS file uploads don't work. iOS 6 will have the ability to do file upload, so you have to put some checks in your code that on iOS 5 and below the user is duly informed apple has forbidden what they're trying to do.