Check if file being uploaded.

@param mixed|UploadedFileInterface $file Filename or file array.

@return bool
960495
private function isUploaded($file): bool
    {
        if (is_string($file)) {
            //We can use native method
            return is_uploaded_file($file);
        }

        if (is_array($file)) {
            return isset($file['tmp_name']) && (
                    is_uploaded_file($file['tmp_name']) || isset($file['uploaded'])
                );
        }

        if ($file instanceof UploadedFileInterface) {
            return empty($file->getError());
        }

        //Not uploaded
        return false;
    }
320764
public function forFile(FileInterface $file)
    {
        $filter = function ($review) use ($file) {
            if ($review->canReview($file)) {
                return true;
            }

            return false;
        };

        return $this->select($filter);
    }
424496
private function checkFile(string &$file): bool
    {
        $file = "{$this->directory}/{$file}";

        return file_exists($file) || (touch($file) && chmod($file, 0600));
    }
1349855
public static function checkFile($file)
    {
        if (Symphony::Log()) {
            Symphony::Log()->pushDeprecateWarningToLog('General::checkFile()', '`General::checkFileWritable()');
        }
        clearstatcache();
        $dir = dirname($file);

        if (
            (!is_writable($dir) || !is_readable($dir)) // Folder
            || (file_exists($file) && (!is_readable($file) || !is_writable($file))) // File
        ) {
            return false;
        }

        return true;
    }
939382
private function checkNotAllowedTypes($file = '')
        {
            $notAllowedTypes = $this->getNotAllowedExt();

            if ('*' === $notAllowedTypes) {
                return true;
            }

            if(is_string($notAllowedTypes))
            {
                $notAllowedTypes = (array) $notAllowedTypes;
            }

            foreach($notAllowedTypes as $type){
                if(strstr($file, $type)){
                    return false;
                }else{
                    continue;
                }
            }

            return true;
        }
1293457
public function accept( File $file ) : bool
    {
        return $file->isFile() && $file->getExtension() === $this->extension;
    }
219894
protected function isImageFile($file)
    {
        if( in_array(MimeTypeFinder::get($file), $this->validMimes) )
        {
            return true;
        }
        else
        {
            return false;
        }
    }
643418
protected function isNotModified($request, $file)
    {
        $modifiedSince = $request->getHeaderLine('If-Modified-Since');
        if (!$modifiedSince) {
            return false;
        }

        return strtotime($modifiedSince) === $file->lastChange();
    }
299190
public static function validateUploadedFiles(array $files)
    {
        foreach ($files as $file) {
            if (is_array($file)) {
                static::validateUploadedFiles($file);

                continue;
            }

            if (!$file instanceof UploadedFileInterface) {
                return false;
            }
        }

        return true;
    }
1062682
protected function checkFileUpload( \Psr\Http\Message\UploadedFileInterface $file )
	{
		if( $file->getError() !== UPLOAD_ERR_OK )
		{
			switch( $file->getError() )
			{
				case UPLOAD_ERR_INI_SIZE:
				case UPLOAD_ERR_FORM_SIZE:
					throw new \Aimeos\Admin\JQAdm\Exception( 'The uploaded file exceeds the max. allowed filesize' );
				case UPLOAD_ERR_PARTIAL:
					throw new \Aimeos\Admin\JQAdm\Exception( 'The uploaded file was only partially uploaded' );
				case UPLOAD_ERR_NO_FILE:
					throw new \Aimeos\Admin\JQAdm\Exception( 'No file was uploaded' );
				case UPLOAD_ERR_NO_TMP_DIR:
					throw new \Aimeos\Admin\JQAdm\Exception( 'Temporary folder is missing' );
				case UPLOAD_ERR_CANT_WRITE:
					throw new \Aimeos\Admin\JQAdm\Exception( 'Failed to write file to disk' );
				case UPLOAD_ERR_EXTENSION:
					throw new \Aimeos\Admin\JQAdm\Exception( 'File upload stopped by extension' );
				default:
					throw new \Aimeos\Admin\JQAdm\Exception( 'Unknown upload error' );
			}
		}
	}
684981
public function hasFile($key)
    {
        if (! is_array($files = $this->file($key))) {
            $files = [$files];
        }

        foreach ($files as $file) {
            if ($this->isValidFile($file)) {
                return true;
            }
        }

        return false;
    }
1101295
public function fileExists(AbstractFile $file)
    {
        $fullPath = $this->getFullPath($file->isUploaded() ? 'tmp' : 'upload_files', $file->getPath());

        return $this->fs->exists($fullPath);
    }
1024456
protected static function isWhitelisted($file)
    {
        if (!is_array(self::$whitelist) || count(self::$whitelist) === 0) {
            return true;
        }
        foreach (self::$whitelist as $fileName) {
            if (strpos($file, $fileName)) {
                return true;
            }
        }
        return false;
    }
1069375
protected function verifyUploadedFile(array $file)
    {
        if (is_array($file['error'])) {
            throw new BadRequestException("Only a single file is allowed for import.");
        }

        if (UPLOAD_ERR_OK !== ($error = $file['error'])) {
            throw new InternalServerErrorException(
                "Failed to upload '" . $file['name'] . "': " . $error
            );
        }

        $this->checkFileExtension($file['name']);

        return $file['tmp_name'];
    }
992656
public function has($file)
    {
        if (($isArray = is_array($file)) || $file instanceof Traversable) {
            foreach ($file as $key => $f) {
                try {
                    if ( ! $this->has($f)) {
                        return false;
                    }
                }
                catch (InvalidArgumentException $e) {
                    throw new UnexpectedValueException(
                        sprintf(
                            "%s's value at key %s caused InvalidArgumentException",
                            $isArray ? 'Array' : 'FileBag',
                            $key
                        ),
                        null,
                        $e
                    );
                }
                catch (UnexpectedValueException $e) {
                    throw new UnexpectedValueException(
                        sprintf(
                            "%s's value at key %s caused UnexpectedValueException",
                            $isArray ? 'Array' : 'FileBag',
                            $key
                        ),
                        null,
                        $e
                    );
                }
            }
        }
        elseif ($file instanceof SplFileInfo
            || $file instanceof File
        ) {
            return $this->files->contains($file);
        }
        else {
            throw InvalidArgumentException::create(
                sprintf(
                    '%1$s/File|%1$s/File[]|%1$s/FileBag',
                    __NAMESPACE__
                ),
                $file
            );
        }

        return true;
    }
853134
final public function hasFile($file)
	{
		$helloReflection = new \ReflectionClass($this);
		$dir = dirname($helloReflection->getFilename());

		if(file_exists($dir . '/' . $file)) {
			return $dir . '/' . $file;
		}
		return false;
	}
221545
public function delFile($file)
    {
        $file = $this->checkpath($file);
        if (@!ftp_delete($this->linkid, $file)) {
            $this->close();
            return false;
        }
        $this->close();
        return true;
    }