marioizquierdo / jquery.serializeJSON

Serialize an HTML Form to a JavaScript Object, supporting nested attributes and arrays.
MIT License
1.71k stars 433 forks source link

It doesn't serialize type=file #122

Closed bshafiei-ir closed 3 years ago

bshafiei-ir commented 3 years ago

Please add it. thanks.

marioizquierdo commented 3 years ago

?

bshafiei-ir commented 3 years ago

what is your question?

I said that when form contains , jsonSerialize can not serialize it. How can I do it?

marioizquierdo commented 3 years ago

This plugin doesn't support <input type="file">. JQuery's serializeArray (the base serialization method this plugin is based of) also doesn't support data types. That is because the W3C rules for successful controls determine that data from file select elements should not be serialized.

In practice, you browser's JavaScript is not allowed to read contents from files. This is for security, otherwise any website could silently upload contents of your file system into their website. If you want to control file uploads from JavaScript, you have other options. Some resources for you: Javascript upload file, file upload with jquery, serialize file input.

Good luck!