Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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



Hi, I want to upload an image ito database and display image in a table in php how it is possible..

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

Hi, I want to upload an image ito database and display image in a table in php how it is possible..

Answer / grayn

First posted answer is given by like a
bharunwachod,madarchod.

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More PHP Interview Questions

Tell me how can we automatically escape incoming data?

0 Answers  


Which functions are used to remove whitespaces from the string?

0 Answers  


What is the use of $_server and $_env?

0 Answers  


How can I maintain the count of how many persons have hit my site?

1 Answers   MTOG, Rushmore Consultancy,


For image work which library is used in php?

0 Answers  


how to detect a mobile device using php

0 Answers  


What is MIME?

1 Answers  


Write a select query that will be displayed the duplicated site name and how many times it is duplicated?

0 Answers  


Write a query to find the 2nd highest salary of an employee from the employee table?

0 Answers  


What is php oops concepts?

0 Answers  


How to get a total number of elements used in the array?

0 Answers  


What is the correct line to use within the php.ini file, to specify that 128mb would be the maximum amount of memory that a script may use?

0 Answers  


Categories