I want to upload images that will be saved in a folder. That folder is inside my website folder. eg: mywebsite(website folder). myimage(image folder).
And the path of image should be saved in mysql.
I tried the following but it is giving error "path not found." This is my path:- C/wamp/www/mywebsite/myimage.
$basePath = "myimage/";
$image = $_FILES['image'];
$storagePath = $basePath.$image['name'];
if (!is_dir($basepath)) {
echo "Base path '$basePath' does not exist";
}
else if (file_exists($storagePath)) {
echo "File '$storagePath' already exists";
}
else if (!move_uploaded_file($image['tmp_name'], $storagePath)) {
echo "Could not move file to '$storagePath'. Check read/write persmissions on the directory";
}
else {
$insertQuery = "INSERT INTO $tbl_name (myImage) VALUES ('".mysql_real_escape_string($image['name'])."')";
$execute=mysql_query($insertQuery); }