File submission in form not working - Statamic 3


I've created a form for visitors that contains some text fields and a file upload field. But I cant's seem to get the file upload to work. I feel like I've done what's written in the docs.

When I submit the form it looks like it goes through, but the file isn't saved anywhere... Then when I go to the forms section in the control panel I can see my submission with all of the right data/texts except that the asset field is empty.

So if someone has an idea to why it might not work that'd be very helpful!

This is from my template: resources > views > sets > career.antlers.html

<div class="career_form"> {{ form:career files="true" }} {{ if success }} <div class="success_message"> Form was submitted successfully. </div> {{ /if }} {{ fields }} <div class="career_form_item"> {{ if error }} <p class="error_message">{{ error }}</p> {{ /if }} <div class="career_form_item_field"> {{ if type == "text" }} <input type="text" placeholder = "{{ instructions }}" name="{{ handle }}" value="{{ old }}" /> {{ /if }} {{ if type == "textarea" }} <textarea name="{{ handle }}" placeholder = "{{ instructions }}" rows = "20" value="{{ old }}"></textarea> {{ /if }} {{ if type == "assets" }} <input class="career_form_upload" type="file" name="upload" /> {{ /if }} </div> </div> {{ /fields }} <button class="career_form_button">Skicka</button> {{ /form:career }} </div>

This is: resources > forms > career.yaml

title: Career blueprint: careerform fields: upload: type: asset container: uploads folder: users

This is the form blueprint if relevant: resources > blueprints > careerform.yaml

title: Careerform sections: main: display: Main fields: - handle: name field: html_type: text character_limit: 40 type: text instructions: Namn localizable: false listable: hidden display: name validate: required - handle: email field: html_type: text character_limit: 50 type: text instructions: 'Din e-post' localizable: false listable: hidden display: email validate: required|email input_type: email - handle: message field: type: textarea instructions: Meddelande localizable: false listable: hidden display: message validate: required - handle: assets field: container: uploads mode: grid restrict: false allow_uploads: true max_files: 1 type: assets instructions: 'Upload your asset here' localizable: false listable: hidden display: Assets

Thanks in advance for the help!

Answered by Erin Dalzell!
>>>>>>> Answered <<<<<<<
2 Replies