how to upload the path of an image to Mysql database with android using php files


i want to add an image's path with android to mysql database using a php file. i added the path with a php file to the database but i failed to connect the android app to the php file si i can put the path of the image from android to mysql database can anyone tell me the rignt procedure for doing it ? this is my php file :

     define('user', 'root');
     define('password', '');
     define('databasename', 'image');

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"      "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>


<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="file" name="file_img" />
<input type="submit" name="btn_upload" value="Upload">  

    $filetmp = $_FILES["file_img"]["tmp_name"];
    $filename = $_FILES["file_img"]["name"];
    $filetype = $_FILES["file_img"]["type"];
    $filepath = "photo/".$filename;


    $sql = "INSERT INTO img (img_name,img_path,img_type) VALUES ('$filename','$filepath','$filetype')";
    $result = mysqli_query($connect,$sql);


People are also looking for solutions to the problem: ubuntu - php mkdir creates a folder with lock icon


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.