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

ImageGallery's useUpload throws 'Missing files' #5

Closed
kevcjones opened this issue Jun 13, 2024 · 1 comment
Closed

ImageGallery's useUpload throws 'Missing files' #5

kevcjones opened this issue Jun 13, 2024 · 1 comment

Comments

@kevcjones
Copy link

kevcjones commented Jun 13, 2024

Expected
To upload an image and see it persist as the code suggests it should

Experienced
useUpload.js thows 'Missing files'

Cause
This error thrown from useUpload.js when data.length is undefined.

if (!data || !data.length) { 
            throw createError({
                statusCode: 400,
                message: "Missing files"
            });
        }

Reason
Current starter example passing in the input from the form form.image which does not have 'length'

Solution
My personal solution was to follow the example more closely from the linked https://hub.nuxt.com/docs/storage/blob#useupload but even that didn't work out of the box.

Fix

await upload([...form.image.files])

Seems to do the trick

@atinux
Copy link
Contributor

atinux commented Jul 30, 2024

Tested and working now

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

2 participants