Determines if this is a valid file object or not.

@return boolean
324193
public function isValid()
    {
        return $this->getID() != null && $this->getURL() != null && $this->getLocalPath() != null;
    }
1346268
public function valid()
    {
        if ($this->container['maxDockableShipVolume'] === null) {
            return false;
        }
        if ($this->container['name'] === null) {
            return false;
        }
        if ($this->container['officeRentalCost'] === null) {
            return false;
        }
        if ($this->container['reprocessingEfficiency'] === null) {
            return false;
        }
        if ($this->container['reprocessingStationsTake'] === null) {
            return false;
        }
        if ($this->container['services'] === null) {
            return false;
        }
        if ($this->container['stationId'] === null) {
            return false;
        }
        if ($this->container['systemId'] === null) {
            return false;
        }
        if ($this->container['typeId'] === null) {
            return false;
        }
        return true;
    }
1311913
public function hasValidSourceFile()
    {
        $sourcefile = $this->getSourceFile();

        return (true === is_readable($sourcefile) && false === is_dir($sourcefile));
    }
896214
protected function isValidFormat()
    {
        //    Reading 2048 bytes should be enough to validate that the format is HTML
        $data = fread($this->fileHandle, 2048);
        if ((strpos($data, '<') !== false) &&
                (strlen($data) !== strlen(strip_tags($data)))) {
            return true;
        }

        return false;
    }
127331
protected function fileExists()
    {
        $this->clearStatCache(true);
        return (file_exists($this->file_path) && is_file($this->file_path));
    }
531875
protected function _isValidFormat()
	{
		// Read sample data (first 2 KB will do)
		$data = fread($this->_fileHandle, 2048);

		// Count delimiters in file
		$delimiterCount = substr_count($data, ';');
		if ($delimiterCount < 1) {
			return FALSE;
		}

		// Analyze first line looking for ID; signature
		$lines = explode("\n", $data);
		if (substr($lines[0],0,4) != 'ID;P') {
			return FALSE;
		}

		return TRUE;
	}
133601
public function isFile(String $name) : Bool
    {
        $file = Method::files($name);

        if( is_array($file) )
        {
            return (bool) $file[0];
        }

        return (bool) Method::files($name);
    }
1330101
public function is_valid_image() {
        $mimetype = $this->get_mimetype();
        if (!file_mimetype_in_typegroup($mimetype, 'web_image')) {
            return false;
        }
        if (!$info = $this->get_imageinfo()) {
            return false;
        }
        if ($info['mimetype'] !== $mimetype) {
            return false;
        }
        // ok, GD likes this image
        return true;
    }
1172615
public function isNamed()
    {
        // If file is not array, then template
        // is not named for sure.
        if ( ! is_array($this->file)) {
            return false;
        }

        // Return false if template is named, but name 
        // is invalid. A valid name should be:
        if (
            isset($this->file[1]) && is_bool($this->file[1]) // should be set and not be a boolean
            || null === $this->file[1] // or null value
            || empty($this->file[1]) // or empty sting or array
        ) {
            return false;
        }

        return true;
    }
797266
public function isApplicable(File $file)
    {
        if (empty($this->databoxes) && empty($this->collections)) {
            return true;
        }

        if (null === $file->getCollection()) {
            return true;
        }

        $fileDatabox = $file->getCollection()->get_databox();

        foreach ($this->databoxes as $databox) {
            if ($databox->get_sbas_id() ===
                $fileDatabox->get_sbas_id()) {
                return true;
            }
        }

        foreach ($this->collections as $collection) {
            if ($collection->get_base_id() === $file->getCollection()->get_base_id()) {
                return true;
            }
        }

        return false;
    }
928953
public function file() {
        $this->check_role = 'file';
        if (!$this->value) {
            $result = false;
        } else if ($this->value instanceof File) {
            $result = is_file($this->value->path_tmp);
        } else {
            $result = is_file($this->value);
        }
        $this->checkResult($result);
        return $this;
    }
1232210
public function verifyFile()
	{
		if (!$this->file)
            return array('error' => Yii::t('ciims.misc', 'No files were uploaded.'));
        
        $size = $this->file->size;

        if ($size == 0) 
            return array('error' => Yii::t('ciims.misc', 'File is empty'));
        
        if ($size > $this->sizeLimit) 
            return array('error' => Yii::t('ciims.misc', 'File is too large'));
        
        $pathinfo = pathinfo($this->file->name);
        $filename = $pathinfo['filename'];

        //$filename = md5(uniqid());
        $ext = $pathinfo['extension'];

        if(!in_array(strtolower($ext), $this->allowedExtensions))
        {
            $these = implode(', ', $this->allowedExtensions);
            return array('error' => Yii::t('ciims.misc', "File has an invalid extension, it should be one of {{these}}.", array('{{these}}' => $these)));
        }

        return array('success' => $filename);
	}
753592
public function validateChunk()
    {
        $file = $this->request->getFile();

        if (!$file) {
            return false;
        }

        if (!isset($file['tmp_name']) || !isset($file['size']) || !isset($file['error'])) {
            return false;
        }

        if ($this->request->getCurrentChunkSize() != $file['size']) {
            return false;
        }

        if ($file['error'] !== UPLOAD_ERR_OK) {
            return false;
        }

        return true;
    }
1201179
public function isValid()
	{
		return isset($this->path)
			|| isset($this->params)
			|| isset($this->anchor)
			|| isset($this->secure)
			|| isset($this->host)
			|| isset($this->port)
			|| isset($this->user)
			|| isset($this->pass);
	}
1342823
public function preValidate(): bool
    {
        $this->errors = [];

        if (!\is_array($this->parsedfile)) {
            $this->errors[] = 'Incorrect format parsed file';

            return false;
        }

        $r = $this->readUNHmessageNumber();
        if (!$r && isset($this->errors[0]) && $this->errors[0] == 'Segment "UNH" is ambiguous') {
            $this->errors = [];
            $this->errors[] = 'File has multiple messages';

            return false;
        }

        return true;
    }
924911
protected function validateFileUpload()
    {
        if ($this->isError()) {
            return null;
        }

        $submitted_files = $this->getSubmitted('files');

        /* @var $file \SplFileInfo */
        $file = reset($submitted_files);
        $request_files = $this->request->file('files');

        if (empty($request_files['name'][0])) {
            $this->setErrorRequired('files', $this->translation->text('Files'));
            return false;
        }

        $result = $this->file_transfer->uploadMultiple($request_files, false, $file->getRealPath());
        $this->setSubmitted('uploaded', $result);
        return true;
    }
154953
public function valid()
    {
        if ($this->_resource === null && $this->_filename) {
            $this->_resource = fopen($this->_filename, $this->_mode);
        }
        return !!$this->_resource && is_resource($this->_resource);
    }