Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
Posts: 124
Registered: ‎11-05-2011
My Device: Z10, Bold 9900
My Carrier: Smartone
Accepted Solution

Is there a File Picker API for WebWorks development in Playbook?

I am looking for a way to prompt user to browse to a file and then access the file in javascript. I found there's something for BlackBerry Smartphone, https://github.com/blackberry/WebWorks-Community-APIs/tree/master/Smartphone/FilePicker. For the same reason mentioned there, I cannot use HTML input field of type "file".

 

Is there any equivalent for Playbook?

Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: Is there a File Picker API for WebWorks development in Playbook?

Hi asiayeah,

 

Unfortunately there doesn't appear to be anything similar to this extension in the Tablet space currently. Seems you would need your own custom control (leveraging WebWorks APIs) or extension (digging down into AIR or AIR > Native) for this at this time.

 

Erik Oros

BlackBerry Development Advisor


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: Is there a File Picker API for WebWorks development in Playbook?

UPDATE

 

Just tried the following on my PlayBook:

http://blackberry.github.com/WebWorks-Samples/kitchenSink/html/html5/file.html

 

And it seems to work fairly well for picking out a file. Source available here:

https://github.com/blackberry/WebWorks-Samples/blob/master/kitchenSink/html/html5/file.html


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Regular Contributor
Posts: 77
Registered: ‎06-02-2012
My Device: Playbook, BB10
My Carrier: Orange

Re: Is there a File Picker API for WebWorks development in Playbook?

[ Edited ]

Hello,

 

How can you get the fullPath of a selected file from an HTML5 file input(with multiple attribute) ?

 

I found this api and it seems that html5 FileEntry has this property, but I can't seem to understand how to use it :smileyhappy:

 

https://developer.blackberry.com/html5/apis/file.html#.file

 

Ultimately I want to be able to select multiple files with html5 file input and get for each one the full name and full path.

I'm developing for PlayBook and I know how I could achieve this using the other file api IO, but I want my app to be compatible with BB10 also.

 

Thanks

Regular Contributor
Posts: 77
Registered: ‎06-02-2012
My Device: Playbook, BB10
My Carrier: Orange

Re: Is there a File Picker API for WebWorks development in Playbook?

nobody? :smileyhappy:

BlackBerry Development Advisor
Posts: 634
Registered: ‎10-01-2009
My Device: All
My Carrier: N/A

Re: Is there a File Picker API for WebWorks development in Playbook?

In BB10 you can use the filePicker Card to grab a file, and get it's full path.  The HTML <input type='file'> you cannot get the full path.

 

For OS < 10 you'll need a custom extension, available here https://github.com/blackberry/WebWorks-Community-APIs/tree/master/Smartphone/FilePicker

 

For Tablet you'll need to create a custom Air extension.

BlackBerry Development Advisor
Posts: 115
Registered: ‎06-06-2011
My Device: 9800
My Carrier: Rogers

Re: Is there a File Picker API for WebWorks development in Playbook?

There is a filePicker API in BB10 and it delivered as a part of the latest WebWorks SDK. Basically you can invoke the FilePicker card and get the full path.

 

https://developer.blackberry.com/html5/apis/blackberry.invoke.card.html#.invokeFilePicker

 

Also I am doing a session at BBJam today about it so I will be uploading the code after the session.

 

 

 

@nukulb
Regular Contributor
Posts: 77
Registered: ‎06-02-2012
My Device: Playbook, BB10
My Carrier: Orange

Re: Is there a File Picker API for WebWorks development in Playbook?

[ Edited ]

Thanks for your answers.

 

Unfortunatelly my knowledge in AIR is very limited and I'm not able to create an extension to use with the current Webworks SDK for tablet. I managed to get all the paths for the type of file I need to select(music) using blackberry.io API. My main issue is that I must create some kind of UI that will let the user select the files he wants from the entire list.

 

I thought that maybe there is a way to achieve what I want by not using separate code for PlayBook 2.0(IO api or custom extension) and BB 10 (invoke cards).

 

At this address https://developer.blackberry.com/html5/apis/file.html there is a property fullPath, documentation states that this api, html5 file is applicable to Playbook OS 1.0+. Is that right? How can I access this property?

 

Anyway, looking forward to your code Nukul :smileyhappy:

 

Happy BBJamming!

BlackBerry Development Advisor
Posts: 115
Registered: ‎06-06-2011
My Device: 9800
My Carrier: Rogers

Re: Is there a File Picker API for WebWorks development in Playbook?

So why do you need the path from input element?

 

you get html5 file and you can read etc..

@nukulb
Regular Contributor
Posts: 77
Registered: ‎06-02-2012
My Device: Playbook, BB10
My Carrier: Orange

Re: Is there a File Picker API for WebWorks development in Playbook?

Yes, I know I can read, but I want to store the paths to the files, and check if the files still exists before use them. 

 

Another question, not related to the previous one, is there any way that a swf embeded in the app could avoid the usual Flash sandbox system? I want to access local files (by using the above paths), but Flash prevents access to local files when not hosted on a domain.

 

It would have been nice to have two modes for webworks apps, a hosted mode(run from http://localhost/) and a normal mode, the way it is now (run from file://).