Skip to content
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

Multipart form with form data is not working #11

Open
parthi-me opened this issue Mar 3, 2022 · 0 comments
Open

Multipart form with form data is not working #11

parthi-me opened this issue Mar 3, 2022 · 0 comments

Comments

@parthi-me
Copy link

parthi-me commented Mar 3, 2022

I have tried to post my form values using the multipart option(https://docs.guzzlephp.org/en/stable/request-options.html#multipart), like the below in my twig template file,

{% set client = {
        base_uri : 'baseURL',
        timeout : 10
    } %}

    {% set destination = 'URLremianing part' %}

    {% set options = {
        headers: {
            'Content-Type': 'application/json',
            'Accept': 'application/json',
            'Authorization': 'Bearer xxxx',
        },
        multipart:[ {
            'name': 'title',
            'contents':  'mr'
        }]
    } %}
getting the error "title" field is required.

Whereas, if I send using the JSON option(https://docs.guzzlephp.org/en/stable/request-options.html#json) it works perfectly,
instead of multipart in the above code, I replaced with, 
  json: {
           'title': 'mr',
           'first_name':  '1'
   }

Can someone please confirm multipart will work with form data fields?

Note : craft cms version(3.7.34)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant