move_uploaded_file (): Unable to move

0
foreach ($_FILES["inputfileSendTorrent"]["error"] as $key => $error) 
    {

        $arqName = $_FILES['inputfileSendTorrent']['name'][$i];
        $arqTemp = $_FILES['inputfileSendTorrent']['tmp_name'][$i];

        if(!@move_uploaded_file($arqTemp, $uploaddir.$arqName))
        {
            $error = error_get_last();
            echo $error['message'];
        }

        $i++;
    }

Returns this error move_uploaded_file(): Unable to move '/tmp/phpTeiKHq' to './arquivos/ZawabMNHXgvV/2MB'

Creating the folder

if(!@mkdir(DIR_ARQUIVOS.$chave, 777, true))
    {
            $error = error_get_last();
            echo $error['message'];
    }
    
asked by anonymous 20.02.2017 / 20:42

1 answer

2

You are wrong @mkdir(DIR_ARQUIVOS.$chave, 777, true) , mkdir should use octal, change 777 by 0777

@mkdir(DIR_ARQUIVOS.$chave, 0777, true)

Read more details at:

20.02.2017 / 20:56