Problems with move_uploaded_file

0

very good afternoon! it happens that I am moving a file loaded, but at the moment of seeing on the server the file does not move! the problem is that yesterday if it worked, but because of problems I have to change the server, however the new server has the same characteristics in which it has PHP 5.6.

the code I am using is (code fragment):

$fecha = Date('Y-m-d-H-i-s');
$ruta = "../view/tmp_files/";
// renombra el archivo con la información anterior
$archivo = $fecha."-".$_FILES['excel']['name'];
// mueve el archivo a la ruta ingresada
//echo "$ruta$archivo";
if (move_uploaded_file($_FILES['excel']['tmp_name'], "$ruta$archivo")) {
    echo "ok";
}else {
    echo "fail";
}

however the tmp_files folder has the appropriate permissions 777

I hope someone knows what is happening and can help me.

Greetings.

PDT: the server is a CentOS 7

    
asked by OriginPnTest 21.04.2017 в 19:02
source

1 answer

0

Take into account that the path you use is relative to the script folder. Verify that the folders "../view/tmp_files" are accessible starting from the location of the script in which the code is. It does not hurt to verify if the file manages to load, it may be that you no longer have disk space or that the extension is not allowed by any policy.

Also, consider using another permission scheme instead of 777 since any user could write it.

    
answered by 21.04.2017 в 19:37