Hi,
I want to upload an image ito database and display image in
a table in php
how it is possible
Answers were Sorted based on User's Feedback
Answer / sarita
make a folder upload in ur directory and to the following
coding:::
if (($_FILES["file"]["type"] !== "image/jpeg") &&
($_FILES["file"]["type"] !== "jimage/peg") &&
($_FILES["file"]["type"] !== "image/png") &&
($_FILES["file"]["type"] !== "image/gif") &&
($_FILES["file"]["type"] !== "image/bmp"))
{
echo "<center><b><font color=#ff0000>Invalid file type,
please select an image with extension .jpg,.gif,.bmp
or.peg</font></b></center>";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],
"upload/" . $_FILES["file"]["name"]);
echo ""."Stored in: "."" . "upload/" .
$_FILES["file"]["name"]."<br>";
$imgname=$_FILES["file"]["name"];
$tmpname=$_FILES["file"]["tmp_name"] ;
$type=$_FILES["file"]["type"];
$size=$_FILES["file"]["size"];
$upload= "upload/" . $_FILES["file"]["name"];
$handle = fopen("$upload", "rb");
$img = fread($handle, filesize($upload));
fclose($handle);
//die($img);
$img = base64_encode($img);
$doe=$_POST['date'];
$result1=mysql_query("insert into tbl_album
values('','".$_POST['aname']."','','$type','$size','$imgname','$doe','".$_POST['shortdes']."','".$_POST['longdes']."')")
or die(mysql_error());
if($result1)
{
echo "<center><b><font color=#0099FF>Album added
Successfully</font></b></center>";
}
$ingname is saved in ur database and folder upload
successfull...u cn change the name of folder acc to u.
Is This Answer Correct ? | 4 Yes | 2 No |
Answer / grayn
First posted answer is given by like a
bharunwachod,madarchod.
Is This Answer Correct ? | 1 Yes | 2 No |
Is set in php?
What is use of htmlspecialchars php?
What are examples of independent and dependent variables?
What are the different functions in sorting an array?
What is empty php?
What are the different loops in php?
How can I find the colour of a pixel of an image?
2 Answers Rushmore Consultancy,
Explain mail function in PHP with syntax?
Is it easy to learn php?
Which character is used to match exactly one character?
Hi, My Name is Ajay Jha. What My Question is I am Percuing in Bca. It's My 5th Semester. I Want To Make My Carrear as a web designer that's Why i wants to do Php, Is it right Desision for Me ?
What do you mean range() in php?