I was testing a simple upload system in my cakephp, for that, I referenced the imgs folder by those paths that the index.php of the root folder gives me. But it was always giving error, saying that the folder path was wrong, and when I echoed the variable, instead of returning /var/www/html/app/webroot/
, I was returning WWW_ROOT
. Neither . DS .
is working. That is, my server is not recognizing the constants of the index.php file 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 does not interpret this constant as it has to be, do you have any access to it?