I am using xampp on my local desktop and created an folder named image.
Path: C:/xampp/htdocs/mycreation/ch-5/images/.
In ch-5 folder i have my php file and also images folder.
now how can i define a $target_dir to that images folder.
for uploading files you can use move_uploaded_file function, which takes the current file and the location you want to save that file.
$file_name = $_FILES['image']['name'];
$file_tmp = $_FILES['image']['tmp_name'];
$target_dir = "images/"; //images directory
if (move_uploaded_file($file_tmp, $target_dir . $file_name)) {
echo "Uploaded file";
else
echo "Failed to upload image";
move_uploaded_filefunction to move the uploaded file to the desired location.