Upload FT, does not upload with custom form
Created 6 years ago by araneaWhen I do {{ form('tickets', 'messages').redirect('tickets/' ~ ticket.id).get()|raw }}
the resulting form has multipart/form-data enctype. But when I do:
{% set form = form('tickets', 'messages').redirect('tickets/' ~ ticket.id).get() %}
{{ form.open|raw }}
It does not and therefore my upload fails. What am I doing wrong?
ryanthompson
—
6 years ago
What happens when you dd in the getPostValue of the upload type?
ryanthompson
—
6 years ago
What about the value - are you trying to use default value or are you uploading a file?
ryanthompson
—
6 years ago
Dd the result of that commmand being dispatched to get the uploaded file.
aranea
—
6 years ago
Ah .. I missunderstood that ;) Let's chalk that up to not being a native speaker.
PerformUpload {#2141 ▼
#fieldType: UploadFieldType {#2221 ▼
#class: ""
#columnType: "integer"
#inputView: "anomaly.field_type.upload::input"
#rules: array:2 [▶]
#validators: array:1 [▶]
#config: array:3 [▶]
#disabled: false
#readonly: false
#messages: []
#entry: TicketModel {#2219 ▶}
#field: "attachment"
#value: null
#label: "Attachment"
#warning: null
#locale: null
#attributes: []
#instructions: null
#placeholder: null
#required: false
#hidden: false
#prefix: null
#save: true
#columnLength: null
#filterView: "streams::form/partials/filter"
#wrapperView: "streams::form/partials/wrapper"
#presenter: null
#modifier: UploadFieldTypeModifier {#2227 ▶}
#accessor: FieldTypeAccessor {#2217 ▶}
#schema: null
#parser: null
#query: null
#criteria: null
#cache: []
#path: "D:\Development\pyro\core/anomaly/upload-field_type"
#type: "anomaly.field_type.upload"
#slug: "upload"
#vendor: "anomaly"
#namespace: "anomaly.field_type.upload"
#callbacks: []
}
}
Ok .. I found a solution .. set the enctype on the form.open like so:
{{ form.open({'enctype': 'multipart/form-data'})|raw }}