I am creating a directory and then moving a uploaded file into it but it gives me this warning
Warning: move_uploaded_file(): The second argument to copy() function cannot be a directory in G:\xampp\htdocs\product_management\admin\process\process_product.php on line 43
Warning: move_uploaded_file(): Unable to move 'G:\xampp\tmp\phpE5B0.tmp' to '../product_images/10/thumb' in G:\xampp\htdocs\product_management\admin\process\process_product.php on line 43
my code is
if($_FILES['thumb']['name']!=="") {
echo $path = "../product_images/".$insert_id."/thumb";
mkdir($path,0777, true);
move_uploaded_file($_FILES['thumb']['tmp_name'],$path);
}
exit;
Try the code above. You can’t move a file to a folder. You move a file to another file name.