How to make to function check with the condition $_FILES?

Hello, please help.
A form
<form method="GET" enctype="multipart/form-data">
 <input name="messimg" type="file" id="messimg"/>
 <h3><textarea name="message" id="textarea"></textarea><input type="submit" name="button" id="button" value=""/></h3>
 </form>

php:
if($_FILES['messimg']['name']) {
 $path = "chat_images/" . time() . $_FILES['messimg']['name'];
 move_uploaded_file($_FILES['messimg']['tmp_name'], "../" . $path);
}

$today = date("F j, Y, g:i a");

//insert values
if($message && $path){
 $stm = $dbh->prepare("INSERT INTO `messages` (`author`, `message`, `time`, `avatar`, `img`) VALUES ('$author', '$message', '$today', '$avatar', '$path')");
$stm->execute();
}

When you select a picture in the form and enter the message is still the selected file is not added to the folder chat_images. What could be the problem?
In advance, thank you.
April 19th 20 at 12:28
1 answer
April 19th 20 at 12:30
Solution
specifies the absolute path, well, the documentation is again read, on the topic of error handling
In move_uploaded_file stated "../" - Mavis_Schulist commented on April 19th 20 at 12:33
is your absolute path? - Ivy.Jakubows commented on April 19th 20 at 12:36
Oh, and the method in form should be POST ) - Ivy.Jakubows commented on April 19th 20 at 12:39
@Ivy.Jakubowsand to do it with GET somehow possible? - Mavis_Schulist commented on April 19th 20 at 12:42

Find more questions by tags PHP