Upload multiple images using FormData Web API
I always knew I could only a single image in javascript using FormData web API. But turns out, I was wrong, kind of, you can upload multiple images using the FormData web API. This API helps to constr
Nicanor Korir
Author
I always knew I could only a single image in javascript using FormData web API. But turns out, I was wrong, kind of, you can upload multiple images using the FormData web API. This API helps to construct key/value pairs, which can then be sent to the server using HTTP.
Let create an input to take user clicks.
Note:
- we have a property called multiple in the input. This will allow users to select multiple files to upload.
- The
enctype, specifies how the form-data should be encoded when submitting to the server, andenctype="multipart/form-data"ensures no characters will be encoded.
we know need javascript to make the input interactive
You only need to send the files array to the server. this will depend on how your server expects this data format if as an array you safe, if other formats, you've to convert to the required format.
Stay in the Loop
Get occasional updates on AI engineering, robotics projects, and lessons from building startups. No spam, unsubscribe anytime.