Predix_Logo
  • Categories
    • Questions
    • Predix | Updates
      • Pricing
      • Product
    • Deloitte - Private
    • How-To
    • Accenture-Private
  • Explore
    • Topics
    • Questions
    • Articles
    • Feedback or Feature Requests
  • Sign in
  • Home /
  • Questions /
avatar image
0
Question by Daniel Durham · Oct 12, 2016 at 06:50 AM · ui-developmentfilesystem-as-a-service

Getting px-file-upload UI element to work in Predix Seed

My requirement is to allow the user to upload a large csv file, and then view this data inside a Polymer/Node application(altered Predix Seed App)

My idea to achieve this is to read the file in browser with the px-file-upload component(or papa-parse if px-file-upload does not work), send the contained data to the NodeJS server, parse it (may not be necessary, or possibly done in browser/client-side), and insert the data into predefined Postgres tables.

Currently I have setup the logic to read in data from my postgres database locally and via the Predix Postgres service, I am able to display and interact with px-file-upload, I am just unsure how or if it is possible to read the file via this component.

Anyone have any experience with this, or have any ideas on how to achieve this goal?

Comment
Add comment
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

  • Sort: 
avatar image
1

Answer by Randy Askin · Oct 12, 2016 at 08:33 AM

Hi @ddurham, the px-file-upload component is essentially just a re-styling of a standard HTML5 <input type=file> element, and can be used in the same way - the files property of px-file-upload contains a FileList array that you can access and process with an XMLHttpRequest. Here is an example from MDN, but I'm sure you can find many more examples online.

Comment
Add comment · Show 1 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Daniel Durham · Oct 14, 2016 at 07:02 AM 0
Share

Thank you @Randy Askin. This has helped significantly. With the above information, I realized I needed to use both: px-file-upload, and papa-parse to convert a csv file into a JSON array in the browser that will be a fit for px-data-table(though I do have an issue with this as well), and to be sent to the web server to be uploaded to Postgres.

Follow this Question

Answers Answers and Comments

54 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

filesystem access 3 Answers

px-vis-timeseries redraw issue 1 Answer

route in predix app not working 2 Answers

proper way to make a webservice call in new predix seed polymer only app 1 Answer

How much data does px-context-browser load? 1 Answer

GE Monogram
  • Legal
  • Cookies
  • Forum Terms
  • Contact Us
  • Copyright © 2017 General Electric Company. All rights reserved.


Enterprise
Social Q&A

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Create an article
  • Submit your feedback or feature request
  • Categories
  • Questions
  • Predix | Updates
    • Pricing
    • Product
  • Deloitte - Private
  • How-To
  • Accenture-Private
  • Explore
  • Topics
  • Questions
  • Articles
  • Feedback or Feature Requests