public function checkFileType(Filesystem $fm, $tmp_dir)
    {
        $di = new \RecursiveDirectoryIterator($tmp_dir);
        foreach (new \RecursiveIteratorIterator($di) as $filepath => $file) {
            $fileInfo = new FileInfo($filepath, $this->getFileManager());
            $mime_valid = $this->checkMimeType($fileInfo);
            if ($mime_valid !== true) {
                $fm->remove($tmp_dir);
                $this->getFileManager()->throwError($mime_valid, 500);
            }
        }

        $fm->remove($tmp_dir);
    }
public function checkFileType(Filesystem $fm, $tmp_dir)
    {
        $di = new \RecursiveDirectoryIterator($tmp_dir);
        foreach (new \RecursiveIteratorIterator($di) as $filepath => $file) {
            $fileInfo = new FileInfo($filepath, $this->getFileManager());
            $mime_valid = $this->checkMimeType($fileInfo);
            if ($mime_valid !== true) {
                $fm->remove($tmp_dir);
                $this->getFileManager()->throwError($mime_valid, 500);
            }
        }

        $fm->remove($tmp_dir);
    }
public function checkFileType ( Filesystem $ fm , $ tmp_dir ) { $ di = new \ RecursiveDirectoryIterator ( $ tmp_dir ) ; foreach ( new \ RecursiveIteratorIterator ( $ di ) as $ filepath => $ file ) { $ fileInfo = new FileInfo ( $ filepath , $ this -> getFileManager ( ) ) ; $ mime_valid = $ this -> checkMimeType ( $ fileInfo ) ; if ( $ mime_valid !== true ) { $ fm -> remove ( $ tmp_dir ) ; $ this -> getFileManager ( ) -> throwError ( $ mime_valid , 500 ) ; } } $ fm -> remove ( $ tmp_dir ) ; }
Check if the file type is an valid file type by extracting the zip inside a temporary directory

@param Filesystem $fm
@param string     $tmp_dir
Check if the file type is an valid file type by extracting the zip inside a temporary directory