I have one fileupload that can select multiple files. But the server side only receives the last selection when I click submit. For instance, first time I select 2 images, then 3 images,totally 5 images. After submitting, server catchs only 3 last images. My idea is putting all the images into one hidden input, then server will get data from hidden input. But I don’t know how to put them in hidden input.
My question is how to put data image into a hidden input ?
You could clone the actual file input. Here’s an example:
Model:
Controller:
View:
The idea is that the original file input is outside of the form. Then everytime the user performs a file selection we are cloning the field and inserting it into the form as a hidden file input. When the form is submitted all files will be uploaded to the server.
A further improvement of the script would obviously be to provide some visual indication to the user of the number of files that are going to be uploaded to the server.