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
Not able to upload files with form #10047
Comments
Form uploads seem to be generally working for me, I've tested in a few sites on the latest version which probably means it's a templating/JS issue. Can you provide the template where you're using the |
If youre using Alpine in front end forms, you need to index the field... eg <input
id="assets_field"
name="assets_field[]"
type="file"
@change="form.assets_field[0] = $event.target.files[0]; form.validate('assets_field[0]')"
/> or alternative this should work (untested) <input
id="assets_field"
name="assets_field[]"
type="file"
@change="form.assets_field = $event.target.files; form.validate('assets_field')"
/> using x-model doesn't work. |
Sure, this is the HTML. The partial
|
Can you try the fix @ryanmitchell suggested? |
@ryanmitchell That worked perfectly, thank you very much. :) |
Bug description
I am not able to upload files when sending the form via AlpineJS. The error message states that "Dateien" has to be an array. I also tried setting
max_files
to 1, but then the error states that 1 file is required, even though a file has been added.While looking for a solution, I stumbled upon this issue, which is essentially the same problem, only that I'm sending via AlpineJS.
This is the JS code:
This is the rendered field in question:
How to reproduce
Create a form and enable attachments. Then use the JS from the bug description to try to send the form.
Logs
No response
Environment
Installation
Fresh statamic/statamic site via CLI
Additional details
No response
The text was updated successfully, but these errors were encountered: