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

Native Development

Posts: 126
Registered: ‎06-25-2013
My Device: Z10
My Carrier: none

Pass a file as a parameter to javascript layer

I have a requirement to pass a file as a parameter to the javascript layer.


i am able to pass any variable to JS layer.


But have to pass a file either an image or a text file to JS layer.


How to pass it ?



Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: Pass a file as a parameter to javascript layer

By JS layer you mean QML? I assume you've seen this page:



The question is not very detailed to give an exact advice, but depending on what you're going to do with that file on JS layer, you can pass a filename, a QByteArray holding the data, or a pointer to a class instance such as Image. If the file resides on disk and will be loaded on QML side, then filename seems to be the most straightforward way.

Andrey Fidrya, @zmeyc on twitter