I need to upload files into an asset folder I have created using a frontend form, however I can't seem to get this to work in Craft 4.

This is the code I have used:

<form method='post' accept-charset='UTF-8' enctype='multipart/form-data'>
      {{ csrfInput() }}
      {{ actionInput('assets/upload') }}
      {{ hiddenInput('folderId', 1) }}

      <input name="assets-upload" type='file'>
      <input type='submit' value='submit'>

I keep getting: 400 error (bad request). What am I doing wrong?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.