3
I was testing a simple upload system in my cakephp, so I referenced the img folder for these paths that the index.php of the root folder gives me. Only it was always giving error, saying that the path of the folder was wrong, and when I gave an echo in the variable, instead of returning me /var/www/html/app/webroot/
, was returning me WWW_ROOT
. Nor the . DS .
is working. That is, my server is not recognizing the file constants index.php in the webroot folder.
$uploaddir = WWW_ROOT;
$uploadfile = $_FILES['userfile']['name'];
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir . DS . $uploadfile)) {
echo "Arquivo válido e enviado com sucesso.\n";
} else {
echo "Possível ataque de upload de arquivo!\n";
}
echo 'Aqui está mais informações de debug:';
print_r($_FILES);
echo $uploaddir;
NOTE: I made 2 files in the webroot folder itself, to have direct access, just to test. I just wanted to know, because my server doesn’t interpret this constant as it has to be, it has some access to it?