Getting an issue with the upload image part from the client.
We have a php form called entry where the client will enter some information that we needs to upload an image. After submitting, the information will be saved into an xml file called data.xml and it will be shown on an html file called display.html
The image have to be saved into a folder called upload. We have this code but I think somewhere we are doing it wrong because it's not working.
This is the part for the image: PHP Code:
$_FILES['file'];
$_FILES["file"]["name"];
$_FILES["file"]["type"];
$_FILES["file"]["size"];
$_FILES["file"]["tmp_name"];
$_FILES["file"]["error"];
if(isset($_POST["file"]['submit'])) {
if ($_FILES["file"]["error"] > 0) {
echo "Error: " . $_FILES["file"]["error"] . "<br>";
}
else {
move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]);
echo "<br>Stored in: " . "upload/" . $_FILES["file"]["name"];
}
} echo $doc->save($file); } ?>
And in the body html we have this:
<label for="file">Image:</label>
<input type="file" name="file" id="file" action:"entry.php" method:"post" entype:"multipart/form-data"><br>
And also it doesn't save anything in the data.xml file. If I remove this code and leave it as it is, the information are saved in the xml form and the display is working.
Can anyone help please?
Thank you