Airship\Cabin\Bridge\Blueprint\Files::moveUploadedFile PHP 메소드

moveUploadedFile() 개인적인 메소드

This method is private to avoid it from being accessed outside of the trusted methods (which handle validation). Don't change it.
private moveUploadedFile ( string $tmp_name ) : string
$tmp_name string
리턴 string "HH/HH/HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH"
    private function moveUploadedFile(string $tmp_name) : string
    {
        $dir1 = \Sodium\bin2hex(\random_bytes(1));
        $dir2 = \Sodium\bin2hex(\random_bytes(1));
        $base = AIRSHIP_UPLOADS . $dir1 . DIRECTORY_SEPARATOR . $dir2;
        if (!\file_exists($base)) {
            \mkdir($base, 0775, true);
        }
        do {
            $filename = \Sodium\bin2hex(\random_bytes(22));
        } while (\file_exists($base . DIRECTORY_SEPARATOR . $filename));
        if (!\move_uploaded_file($tmp_name, $base . DIRECTORY_SEPARATOR . $filename)) {
            throw new UploadError(\__('Could not move temporary file to its permanent home'));
        }
        return $dir1 . DIRECTORY_SEPARATOR . $dir2 . DIRECTORY_SEPARATOR . $filename;
    }