photo upload
<html>
<head>
<script src="assets/js/jquery-1.10.2.js"></script>
<!-- BOOTSTRAP SCRIPTS -->
<script src="assets/js/bootstrap.js"></script>
<!-- PAGE LEVEL SCRIPTS -->
<script src="assets/js/bootstrap-fileupload.js"></script>
<!-- METISMENU SCRIPTS -->
<script src="assets/js/jquery.metisMenu.js"></script>
<!-- CUSTOM SCRIPTS -->
<script src="assets/js/custom.js"></script>
</head>
<body>
<form method="post" enctype="multipart/form-data">
<input type="file" name="photo"><br>
<input type="submit" name="submit" value="SEND">
</form>
<?php
$con=mysqli_connect("localhost","root","root","img") or die(mysqli_error());
if(isset($_POST['submit']))
{
extract($_POST);
$name=$_FILES['photo']['name'];
$type=$_FILES['photo']['type'];
$size=$_FILES['photo']['size'];
$temp=$_FILES['photo']['tmp_name'];
move_uploaded_file($temp,"abc/".$name);
$query=mysqli_query($con,"insert into img1(name,type,size) value('$name','$type','$size') ") or die(mysqli_error($con));
}
?>
<?php
$con=mysqli_connect("localhost","root","root","img") or die(mysqli_error());
$que=mysqli_query($con,"select * from img1") or die(mysqli_error($con));
?>
<table border="1">
<tr>
<td>ID</td>
<td>img</td>
<td>type</td>
<td>size</td>
</tr>
<?php
while($fet=mysqli_fetch_array($que))
{
extract($fet);
?>
<tr>
<td><?php echo $id; ?></td>
<td><img src="abc/<?php echo $name; ?>" height="200" width="200"></td>
<td><?php echo $type; ?></td>
<td><?php echo $size; ?></td>
</tr>
<?php
}
?>
</table>
<select>
<option>Select any one</option>
<?php
$con=mysqli_connect("localhost","root","root","img") or die(mysqli_error());
$quer=mysqli_query($con,"select * from img1") or die(mysqli_error($con));
while($dr=mysqli_fetch_array($quer))
{
extract($dr);
echo "<option value='$name'>$name</option>";
}
?>
</select>
</body>
</html>
<head>
<script src="assets/js/jquery-1.10.2.js"></script>
<!-- BOOTSTRAP SCRIPTS -->
<script src="assets/js/bootstrap.js"></script>
<!-- PAGE LEVEL SCRIPTS -->
<script src="assets/js/bootstrap-fileupload.js"></script>
<!-- METISMENU SCRIPTS -->
<script src="assets/js/jquery.metisMenu.js"></script>
<!-- CUSTOM SCRIPTS -->
<script src="assets/js/custom.js"></script>
</head>
<body>
<form method="post" enctype="multipart/form-data">
<input type="file" name="photo"><br>
<input type="submit" name="submit" value="SEND">
</form>
<?php
$con=mysqli_connect("localhost","root","root","img") or die(mysqli_error());
if(isset($_POST['submit']))
{
extract($_POST);
$name=$_FILES['photo']['name'];
$type=$_FILES['photo']['type'];
$size=$_FILES['photo']['size'];
$temp=$_FILES['photo']['tmp_name'];
move_uploaded_file($temp,"abc/".$name);
$query=mysqli_query($con,"insert into img1(name,type,size) value('$name','$type','$size') ") or die(mysqli_error($con));
}
?>
<?php
$con=mysqli_connect("localhost","root","root","img") or die(mysqli_error());
$que=mysqli_query($con,"select * from img1") or die(mysqli_error($con));
?>
<table border="1">
<tr>
<td>ID</td>
<td>img</td>
<td>type</td>
<td>size</td>
</tr>
<?php
while($fet=mysqli_fetch_array($que))
{
extract($fet);
?>
<tr>
<td><?php echo $id; ?></td>
<td><img src="abc/<?php echo $name; ?>" height="200" width="200"></td>
<td><?php echo $type; ?></td>
<td><?php echo $size; ?></td>
</tr>
<?php
}
?>
</table>
<select>
<option>Select any one</option>
<?php
$con=mysqli_connect("localhost","root","root","img") or die(mysqli_error());
$quer=mysqli_query($con,"select * from img1") or die(mysqli_error($con));
while($dr=mysqli_fetch_array($quer))
{
extract($dr);
echo "<option value='$name'>$name</option>";
}
?>
</select>
</body>
</html>
Comments
Post a Comment