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?
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.
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.
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