-1

i want the name of the image to be saved in database and the file to be save into a folder of my choice. the image name is setting saved into database but the problem is that i am unable to upload the image into a folder. so please help.

This is the code i am using.

mysqli_query($con,"INSERT INTO blog (title, image, content)
            VALUES ('$_POST[title]', '$_POST[image]','$_POST[content]')");

    $target_Path = "uploaded/";
    $target_Path = $target_Path.basename( $_FILES['image']['name'] );
    move_uploaded_file( $_FILES['image']['tmp_name'], $target_Path );
4

1 回答 1

1

像这样使用绝对路径:

$target_Path = "/var/www/html/uploaded/";
$target_Path = $target_Path.basename( $_FILES['image']['name'] );
move_uploaded_file( $_FILES['image']['tmp_name'], $target_Path );
于 2013-11-13T16:50:53.243 回答