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: 676
Registered: ‎05-06-2012
My Device: Dev Alpha & PlayBook
My Carrier: wifi

Get file text with QML/Javascript

I have a file picker that lets the user select a text file. How can I get the contents of the text file into a javascript variable? 


FilePicker {

            id: picker


            property string selectedFile


            title: qsTr("File Picker")

            mode: pickerMode.selectedValue

            type: pickerType.selectedValue

            viewMode: pickerViewMode.selectedValue

            sortBy: pickerSortBy.selectedValue

            sortOrder: pickerSortOrder.selectedValue


            onFileSelected: {

                selectedFile = selectedFiles[0]

                console.log("PK - "+selectedFile)



co-founder of Diaree | BB Dev for PictureThis
Posts: 713
Registered: ‎05-31-2010
My Device: 8520
My Carrier: Movistar

Re: Get file text with QML/Javascript