Search code examples
angularjsng-file-uploadflow-js

Uploading users data using CSV file with flow JS


I want to provide upload functionality to my angular JS application , I want to restrict user to upload only CSV/XSL files only,and the File size must be restricted to 100KB ,the users data from the file should be stored in the local storage of browser using Flow JS, I am new to Flow JS ,can anyone give me hint or code-snippet to implement this.I don't wanna use any backend only local storage to store my data


Solution

  • To restrict selectable files to CSV and XLS or XSLX, use FlowJS assignBrowse method :

    .assignBrowse(domNodes, isDirectory, singleFile, attributes)
    

    This way

    flow.assignBrowse(element, false, false, {"accept": ".csv,.xls,.xlsx"});
    

    Read official docs for more : https://github.com/flowjs/flow.js/#methods

    Unfortunately, this is no limit for filesize.

    But you'll find some useful information on this thread which could help :