0

Saving images in the database

how i can save the images in database uploaded through a form .

16th Mar 2017, 7:39 PM
Irfan Ahmad
Irfan Ahmad - avatar
4 Respostas
+ 5
You can: 1. Save it as binary data to the database. 2. Upload it to a folder and save the reference/file name to the database. (this one is better)
16th Mar 2017, 8:48 PM
James Flanders
0
build cover folder for upload image ---------- if(isset($_POST['submit'])) { $cover=$_FILES['cover']['name']; $tmp=$_FILES['cover']['tmp_name']; if($cover) { move_uploaded_file($tmp,"cover/$cover"); } $sql=mysql_query("INSERT INTO table(column_name)VALUES('$cover')")or die("erroruploading".mysql_error()); }
16th Mar 2017, 7:49 PM
Aung Aung
Aung Aung - avatar
0
thanks than how i can retrieve that file from database to display in a web page
16th Mar 2017, 7:53 PM
Irfan Ahmad
Irfan Ahmad - avatar
0
use query-->SELECT * FROM tablename I cannot tell you detail.You can easily find code in stack overflow
16th Mar 2017, 8:11 PM
Aung Aung
Aung Aung - avatar