Saturday, April 16, 2016

Uploading Image File With PHP (Upload General Image) : Part-03

Related Code:
   if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $permited  = array('jpg', 'jpeg', 'png', 'gif');
       $file_name = $_FILES['image']['name'];
    $file_size = $_FILES['image']['size'];
    $file_temp = $_FILES['image']['tmp_name'];
    $folder = "uploads/";
    move_uploaded_file($file_temp, $folder.$file_name);
    $query = "INSERT INTO tbl_image(image) VALUES('$file_name')";
    $inserted_rows = $db->insert($query);
    if ($inserted_rows) {
     echo "<span class='success'>Image Inserted Successfully.
    }else {
     echo "<span class='error'>Image Not Inserted !</span>";

How to practice tutorials…

  • Make a team with your friends (Member should be 4/5).
  • Start to practice one tutorial series along with them.
  • Don’t try to collect source code. Type the code while watching the tutorial.
  • If you face any problem, discuss with team members to solve quickly.