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")
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:
It works fine when running the app from the terminal outside GB.
Here's the code I'm testing with: