Genie Discord forum
Hi friends here, I am going to build a simple web app with genie builder, for accept csv file and do some analysis. But I found it is much difficult for me to findout how could I upload, then how and where could I acess the upload file? and there is no UI element for upload data in genie builder, is it just because the builder is not a finished tool?
Changed the channel name: how to upload a csv file with in genie builder
At the moment, the file uploader component is not supported in Genie Builder. You'd have to include it in the HTML with something like
<% uploader(label="Upload Dataset", accept=".csv", multiple=true, method="POST", url="http://localhost:8000/", field__name="csv_file", @on("uploaded", :uploaded))
%>
This component requires a little setup to get it working. We have a tutorial and a repo with an example
Thank you very much, it is a great resource for learning.
I am still a little confused. I could add the file uploader component in the html page, but I cannot upload the file to server.
in the csvuploader tutorial, there is some route code to handle the post event:
route("/", method=POST) do
# some code...
upfiles = readdir(FILE_PATH)
# some other code...
end
@page("/", "ui.jl")
but in my code, since I use the genie builder to make the UI page, I have below code in app.jl:
@app begin
# my logit code here
@onchange xxx begin
# ...
end
end
@page("/", "app.jl.html")
and my html page is something like:
<div>
<% uploader(label="Upload Dataset", accept=".csv", multiple=true, method="POST", url="http://localhost:9101/upload", field__name="csv_file", @on("uploaded", :uploaded))
%>
</div>
so how could I add a route rule to tell the app how to handle the upload files?
finally I solved this, and just give a record here:
- insert. the uploader html. code into app.jl.html, include them with "<% %>"
- add the configure within the app,jl, before "@app begin"
- this is the key step!!! restart the whole app, the genie donot autoreload it!!! even its log shows it is autoreload on every save step!!!