Software Archive
Read-only legacy content
17061 Discussions

How to read a selected file in intel XDK

Anjali_P_
Beginner
460 Views

Hii....

I want to create sample app where the user can choose a file (used input element of type file), and on click of button , the user should be able to view the the selected  file in the preview div element.

I want selected file to be read and display the  content of the file in the preview.

Please provide me the solution. Reply soon...

Regards,

Anjali Paria.

0 Kudos
1 Reply
Swati_S_Intel1
Employee
460 Views

Use Cordova File plugin : https://github.com/apache/cordova-plugin-file. Use the FileReader object to read the file. I'm assuming you are familiar with how to include the plugins in the XDK. If not, please refer to this article : https://software.intel.com/en-us/xdk/docs/add-manage-project-plugins. Also, here is a simple example code of reading a file using Cordova File plugin. http://www.raymondcamden.com/2014/07/15/Cordova-Sample-Reading-a-text-file/

 

0 Kudos
Reply