I put a PHP code to upload images, the images are not being saved in the directory with the code below:
$post_id = $db->insert($query);
$ext = explode('.', $_FILES['img']['name']);
$path = "../content/img/".$post_id.".".$ext[count($ext)]-1;
$img = move_uploaded_file( $_FILES["img"]["tmp_name"], $path);
var_dump $ path int -1
$ ext var_dump
array (size=2)
0 => string 'nome-da-imagem' (length=14)
1 => string 'jpg' (length=3)
(Já que é uma imagem jpg)
var_dump $ img boolean true
But when I modify the $ path variable to only $path = "../content/img/".$post_id;
var_dump gives string '../content/img/60' (length=17)
It saves (60 because it is the ID of this new post), but without the extension.