How to store images in mysql database using php

前端 未结 4 1924
猫巷女王i
猫巷女王i 2020-12-02 19:41

How can i store and display the images in a MySQL database. Till now i have only written the code to get the images from the user and store them in a folder, the code that i

4条回答
  •  时光说笑
    2020-12-02 20:05

    insert image zh

    -while we insert image in database using insert query

    $Image = $_FILES['Image']['name'];
        if(!$Image)
        {
          $Image="";
        }
        else
        {
          $file_path = 'upload/';
          $file_path = $file_path . basename( $_FILES['Image']['name']);    
          if(move_uploaded_file($_FILES['Image']['tmp_name'], $file_path)) 
         { 
    }
    }
    

提交回复
热议问题