Skip to content

Instantly share code, notes, and snippets.

@ErMandeep
Created December 3, 2018 10:56
Show Gist options
  • Save ErMandeep/39ff4235125fe2db194734aac306a334 to your computer and use it in GitHub Desktop.
Save ErMandeep/39ff4235125fe2db194734aac306a334 to your computer and use it in GitHub Desktop.
<?php
if(isset($_POST['submit'])){
$img1 = pathinfo($_FILES["image"]["name"], PATHINFO_EXTENSION);
$name1 = rand(1,5000).".".$img1;
move_uploaded_file($_FILES["image"]["tmp_name"],"./images/$name1");
$sql = "UPDATE venders SET image1 = '$name1' WHERE id=2";
$query = mysqli_query($connection, $sql);
if(!$query){
echo "0";
}else {
echo "1";
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment