Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File uploader component not working in Genie Builder #65

Open
PGimenez opened this issue May 31, 2024 · 0 comments
Open

File uploader component not working in Genie Builder #65

PGimenez opened this issue May 31, 2024 · 0 comments

Comments

@PGimenez
Copy link
Member

I'm trying to add the uploader component to GB, but when using it inside of GB it does not work. The file is not uploaded and the following exception is thrown:

┌ Error: 2024-05-31 14:08:13 Error processing file: Base.IOError("open(\"/var/folders/h_/l8hxc31x73s97400gprpwnr80000gn/T/jl_Yxe327A5U9\", 0, 0): no such file or directory (ENOENT)", -2)
└ @ Main ~/genie/mwes/CSVUploader/app.jl:19

It works fine when running the app from the terminal outside GB.

Here's the code I'm testing with:

 using GenieFramework
@genietools

const FILE_PATH = joinpath("public", "uploads")
mkpath(FILE_PATH)

@app begin
    @onchange fileuploads begin
        @show fileuploads
        if ! isempty(fileuploads)
            @info "File was uploaded: " fileuploads
            notify(__model__,"File was uploaded: $(fileuploads)")
            filename = fileuploads["name"]

            try
                isdir(FILE_PATH) || mkpath(FILE_PATH)
                mv(fileuploads["path"], joinpath(FILE_PATH, filename), force=true)
            catch e
                @error "Error processing file: $e"
                notify(__model__,"Error processing file: $(fileuploads["name"])")
            end

            fileuploads = Dict{AbstractString,AbstractString}()
        end
        upfiles = readdir(FILE_PATH)
    end



end


@page("/", "app.jl.html")
<q-uploader id="ixnz" accept=".png, .jpg" :auto-upload="true" :hide-upload-btn="true" label="Upload files" :max-files="3" :multiple="true" :no-thumbnails="true" :url="'/____/upload/' + channel_"></q-uploader>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant