Я попытался загрузить изображение в каталог на моем сервере с кодом ниже.Однако, когда я запускаю его, я получаю эту ошибку:
Предупреждение: move_uploaded_file (images /) [function.move-uploaded-file]: не удалось открыть поток: есть каталог в/home/a2943534/public_html/add.php в строке 24
Предупреждение: move_uploaded_file () [function.move-uploaded-file]: невозможно переместить '/ tmp / php7yEkDe' в'images /' в /home/a2943534/public_html/add.php в строке 24
Что мне здесь не хватает, пожалуйста?
<?php
include_once("connect.php");
?>
<?php
//This is the directory where images will be saved
$target = "images/";
$target = $target . basename( $_FILES['photo']['title']);
//This gets all the other information from the form
$title=$_POST['title'];
$name=$_POST['name'];
$describe=$_POST['describe'];
$pic=($_FILES['photo']['title']);
$url=$_POST['url'];
$country=$_POST['country'];
$endDate=$_POST['endDate'];
//Writes the information to the database
mysql_query("INSERT INTO `authors` VALUES ('$title', '$name', '$describe', '$pic', '$url', '$country', '$endDate')") ;
//Writes the photo to the server
if(move_uploaded_file($_FILES['photo']['tmp_name'], $target))
{
//Tells you if its all ok
$result = "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";
}
else {
//Gives and error if its not
$result = "Sorry, there was a problem uploading your file.";
}
?>
<?php
// if the form has been submitted, display result
if (isset($result)) {
echo "<p><strong>$result</strong></p>";
}
?>