+ 1
How to upload image and input text with ajax jquery in mysql database
Note : I can upload image and input text with ajax jquery in mysql database as Seprate. I want to insert data image and text together in database?
1 Réponse
+ 1
You can have any columns you want in an SQL table so it just takes pretty basic knowledge of SQL to add a column for text in the same table as a blob for the raw binary data of your image.
Sending text with your HTTP request to the server is a completely isolated problem from how your server saves the image. There are many options.
Check the answers here: https://stackoverflow.com/questions/41949148/ajax-sending-input-file-and-additional-variable-to-php-file-through-ajax
I know you want to send this using JavaScript but JavaScript can send every kind of HTTP request that a regular HTML form can. "multipart/form-data" is an encoding typically used to send files and could lead to simpler PHP code for processing the uploaded files. You can send as many parameters as you want along with a parameter corresponding with your file. Some of the answers from the above link would use multipart/form-data encoding without making that explicitly clear.