Viewing file: ddupdateprint.php (1.23 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
$var = $_POST[ids] ;
?>
<?php $con=mysqli_connect("localhost","anshdiam_user","rb!ans838","anshdiam_sarkmicr_data"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); }
$target = "upload/"; $path = "upload/"; $valid_formats = array("jpg", "png", "gif", "bmp","jpeg"); if(isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST") { $name = $_FILES['photo']['name']; $size = $_FILES['photo']['size']; if(strlen($name)) { list($txt, $ext) = explode(".", $name); if(in_array($ext,$valid_formats)) { if($size<(1024*1024)) // Image size max 1 MB { $actual_image_name = time().$session_id.".".$ext; $tmp = $_FILES['photo']['tmp_name']; $target = $target.basename($_FILES['photo']['name']); //This gets all the other information from the form
$pic=$actual_image_name; }}}}
$sql ="UPDATE dd SET photo='$pic' WHERE ID='$var'";
if(move_uploaded_file($_FILES['photo']['tmp_name'], $path.$actual_image_name)) ; { } if (!mysqli_query($con,$sql)) { die('Error: ' . mysqli_error($con)); }
mysqli_close($con);
?> Your Photo is Successfully Updated. <form action=""><input type="button" value="GOBACK" onclick="window.location.href='ddaccountlist.php';"/> </form>
|