public function validateFile(FileInfo $fileInfo, $new_filename = null)
    {
        $file_path = $fileInfo->getFilePath(true);

        if (!is_dir($file_path)) {
            $fm = new Filesystem();
            $tmp_dir = $this->createTmpDir($fm);
            $fm->copy($file_path, $tmp_dir . FileManager::DS . $fileInfo->getFilename());

            if (!is_null($new_filename)) {
                $new_filename = basename($new_filename);
                $fm->rename($tmp_dir . FileManager::DS . $fileInfo->getFilename(),
                    $tmp_dir . FileManager::DS . $new_filename);
            }

            $this->checkFileType($fm, $tmp_dir);
        }
    }
public function validateFile(FileInfo $fileInfo, $new_filename = null)
    {
        $file_path = $fileInfo->getFilePath(true);

        if (!is_dir($file_path)) {
            $fm = new Filesystem();
            $tmp_dir = $this->createTmpDir($fm);
            $fm->copy($file_path, $tmp_dir . FileManager::DS . $fileInfo->getFilename());

            if (!is_null($new_filename)) {
                $new_filename = basename($new_filename);
                $fm->rename($tmp_dir . FileManager::DS . $fileInfo->getFilename(),
                    $tmp_dir . FileManager::DS . $new_filename);
            }

            $this->checkFileType($fm, $tmp_dir);
        }
    }
public function validateFile ( FileInfo $ fileInfo , $ new_filename = null ) { $ file_path = $ fileInfo -> getFilePath ( true ) ; if ( ! is_dir ( $ file_path ) ) { $ fm = new Filesystem ( ) ; $ tmp_dir = $ this -> createTmpDir ( $ fm ) ; $ fm -> copy ( $ file_path , $ tmp_dir . FileManager :: DS . $ fileInfo -> getFilename ( ) ) ; if ( ! is_null ( $ new_filename ) ) { $ new_filename = basename ( $ new_filename ) ; $ fm -> rename ( $ tmp_dir . FileManager :: DS . $ fileInfo -> getFilename ( ) , $ tmp_dir . FileManager :: DS . $ new_filename ) ; } $ this -> checkFileType ( $ fm , $ tmp_dir ) ; } }
Validate the files to check if they have a valid file type

@param FileInfo    $fileInfo
@param null|string $new_filename
Validate the files to check if they have a valid file type