Uploading Blob Image In Mysql Database And Displaying It With Php
How To Upload Blob Image Into Mysql Database And Display Them.
To upload image in mysql database, first you need to create the database itself. If you already have the existing database, then select it after starting your server. In most cases, for testing purposes local hosts are used. Talking about local hosts we have two mostly used : Xampp and WampServer. To get connected you need to have server name username and password. When you are connected to the server select the database or create a new database. Databases is a collection of tables in programming. Create a table where the the data send to the server will be saved. Here we are focusing on BLOB'S. BLOB means binary large object. Inside the created table we must have a column of datatype blob. This column is where the images will be saved. sometimes images are saved in a given folder in the server and the image location/path stored in the database. That's not what were are trying to do , instead we a saving images as a whole. Now when the database is all setup. It's time to create html form for sending the data to the server to be processed by the scripting language, which is php. Some other languages like java server pages (Jsp) or asp may be used. Inside the form tags you should specify enctype attribute with value multipart/form-data. Then the form should have input tags with type of file. This is for selecting files from the computer. That's pretty much everything.
Finally make queries for inserting and selecting the data to display on a web page by using sql and php.
References :
Comments