Skip to content

How to upload multiple files? #85

@palandlom

Description

@palandlom

I try to do it in following way:

	clt := mgql.NewClient("http://0.0.0.0:7071/graphql", mgql.UseMultipartForm())

	query := `
		mutation ($files: [Upload!]!) {  
  			addLpFiles(	input: { files: $files }) 
		{success}}`
	req := mgql.NewRequest(query)

	for i, s := range []string{"aaa", "bbb"} {
		r := strings.NewReader(s)
		req.File("files."+strconv.Itoa(i), s, r)
		//req.File(strconv.Itoa(i), s, r)
	}

	err := clt.Run(ctx, req, nil)
	if err != nil {
		return err
	}

... and get error - graphql: first part must be operations.

PS: without .UseMultipartForm() usual read queries go well

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions