i have inserting url of images into database table :first of all , the image is uploaded into a folder named uploads ( it is a sub folder of an other one named projet) in the server ( i'm using actually 000.webhost.com) , after that inserted in the table , the format of url actually is like that ( uploads/1494162719350.jpg).How Could i change the target_path( in the php code below) in order to obatin an url like(https://stationpfe.000webhostapp.com/projet/uploads/1494194541508.jpg ). here is the structure of folders in the server . structure of folders
<?php
header('Access-Control-Allow-Origin: *');
require_once("db_connect.php");
$target_path = "uploads/";
if(isset($_FILES['file']))
{
$target_path = $target_path . basename( $_FILES['file']['name']);
if (move_uploaded_file($_FILES['file']['tmp_name'], $target_path))
{
//$image=basename( $_FILES["file"]["tmp_name"],".jpg"); // used to store the filename in a variable
//storind the data in your database
//$QueryInsertFile="INSERT INTO TableName SET ImageColumnName='$target_path'";
$query= "INSERT INTO items SET pic='$target_path'";
mysqli_query($con,$query);
echo "success";
} else
{
echo $target_path;
echo "There was an error uploading the file, please try again!";
}
}
?>
</div>