Skip to content

File Upload - Cannot manage csv file after uploaded. #2244

Answered by marek-mihok
adrianrjh asked this question in Q&A
Discussion options

You must be logged in to vote

@adrianrjh To use the files uploaded from the browser to the wave server you have to first download it into the wave app. Here is the updated example:

import csv
from h2o_wave import main, app, Q, ui

@app('/')

async def serve(q: Q):
    data_rows = []
    if 'file_upload' in q.args:
        # Since multiple file uploads are allowed, the file_upload argument is a list.
        for path in q.args.file_upload:
            # To use the file uploaded from the browser to the wave server, download it into the app.
            local_path = await q.site.download(path, '.')
            with open(local_path) as csvfile:
                # Do something with the file located at local_path

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mturoci
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Question
2 participants
Converted from issue

This discussion was converted from issue #2238 on January 31, 2024 08:18.