-
Notifications
You must be signed in to change notification settings - Fork 641
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
Ability to set enctype="multipart/form-data"
on custom CP forms
#1665
Comments
FWIW, I've hacked my local copy to allow this. But hacking the core is obviously not a good long-term solution. |
Took it in a different direction, but the next release has a change that will make this possible: All of the {% block containerAttributes -%}
{{ parent() }} enctype="multipart/form-data"
{%- endblock %} |
Brilliant! Thanks Brandon! |
Just implemented this... works perfectly. 👍 |
Does this still exist in Craft 3? Just tried it and it didn't seem to work. Can this functionality be re added please so I can create a form within a cp section which submits files, e.g. screenshots of an issue. Thank you. |
@matt-adigital Yeah looks like that never made it to Craft 3. Just added a new |
We've got a custom plugin which has several back-end pages. On one of these pages, we've created a small form which allows admins to send short messages.
Recently, I've been asked to add attachments to this form. It nearly works perfectly, with only one shortcoming... the form is missing the
enctype="multipart/form-data"
attribute.Like most back-end pages, this page extends
_layouts/cp
. We're using thefullPageForm = true
variable to denote that the entire page should behave as a single form. Here is the Craft code which opens the form tag...You'll notice that
enctype="multipart/form-data"
is conspicuously absent (as it should be for 99% of back-end forms). Unfortunately, this is one of the rare cases where we need that attribute to exist.Feature Request
Just as we have a
fullPageForm
variable, could we also have anallowUploads
variable?That would be sweet!
Internally, Craft would simply apply
enctype="multipart/form-data"
according to whether or notallowUploads
is set to true.Thanks guys! Let me know if you need any clarification! :)
Additional info
The text was updated successfully, but these errors were encountered: