Closed flimybook closed 2 years ago
The example shows 2 files in variables, but you could have 1, or 10, it doesn't matter. The important thing is to understand the structure of how each uploaded file is accounted for in the fields of the multipart request. The request can be programmatically generated by looping the files you want to upload; you don't need to hardcode the request with a fixed number of files.
Here is a JavaScript example of dynamically generating a GraphQL multipart request based upon the files used in variables:
Thank you. In you given link Every think is clear. You are very good person...
For above mutation, you this example- curl localhost:3001/graphql \ -F operations='{ "query": "mutation($files: [Upload!]!) { multipleUpload(files: $files) { id } }", "variables": { "files": [null, null] } }' \ -F map='{ "0": ["variables.files.0"], "1": ["variables.files.1"] }' \ -F 0=@b.txt \ -F 1=@c.txt
But Here User can upload 1 or 2 or 3 or 5 or any numbers of file. How can I understand user only upload 2 files? If I write above code User only can upload 2 files, If user want to upload 3 or 5 files or any number of files then?