Support the ongoing development of Laravel.io →
Laravel.io

Hello Guys , I have a code that is working fine in Vue , but when I compiled it on Webpack , is not working properly any more .

I discovered that It is not appending an array value in FormData , it is bring to php a empty value .

It is like this the code -

IT IS NOT WORKING IN WEBPACK WHEN I COMPILE

var data = new FormData();
data.append('my_inputs[]', 'image 1');
data.append('my_inputs[]', 'image 2');
data.append('my_inputs[]', 'image 3');

// then I send the value with vue
axios.post('myurl.com', data) ....
.

IT WORKS LIKE THIS

var data = new FormData();
data.append('input_1', 'image 1');
data.append('input_2', 'image 2');
data.append('input_3', 'image 3');

// then I send the value with vue
axios.post('myurl.com', data) .....

I wold like to make as the first option , becose it is a image gallery and I dont know how many images the user gonna pick . But it is not working when I compile on webpack , it does not gives any error , but bring a empty value to php .

Does some one knows what can I do ?

Thanks .

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.