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

If the same key name in formdata #93

Open
seceba opened this issue Jun 15, 2022 · 2 comments
Open

If the same key name in formdata #93

seceba opened this issue Jun 15, 2022 · 2 comments

Comments

@seceba
Copy link

seceba commented Jun 15, 2022

Hello,

I am trying to send multiple keys/value with the same key name using the post method using form-data.

However, I can only get the last one of the values with the same key name.

My goal is to upload images to the server using the same key like file[] name but I can only get the last one.

How can I handle form-data keys using the same key name?

Form-Data looks like this.

name = "John"
Age = 24
file[] = Image1.jpg
file[] = Image2.jpg
file[] = Image3.jpg
file[] = Image4.jpg

Whenever I check the incoming data, only image4 is read. What I want to do is to loop and process how many file[] there are.

When sending the Form-Data, I can make the key names as file[1] file[2], but I wonder why I can't do this by sending the same name, is this feature not supported or did I fail.

PS: Thank you very much for the beautiful package, it is a great job.

@rknell
Copy link
Owner

rknell commented Jun 17, 2022

Hey,

sorry for the late reply. The parsing is performed by an old official dart library from google that was discontinued, who while I haven't dug into it heavily, I would suggest its probably one of those things thats not supported right now but should be. So you didn't fail! For now use the workaround but I will keep the issue open and i'll have a look into when I'm poking around that part of the package.

@rknell
Copy link
Owner

rknell commented Dec 5, 2022

So a bit more information here - it seems dart just doesn't know how to do arrays with form data. I came across this separately trying to do a call to stripe when setting up my web store. The dart stripe library has it worked out and i'll see if I can implement what they have done.

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

2 participants