Returns true if the form was submited and there was a file uploaded.

@return boolean
420945
public function isUploaded()
    {
        if ($this->form->isSubmitted() && is_array($this->value) && $this->value['error'] == UPLOAD_ERR_OK) {
            return true;
        }

        return false;
    }
1107220
public function wasSubmitted()
    {
        // If form was not (yet) populated, we can not use isChecked() so do this manually
        $request = $this->getRequest();
        if ($request->isPost() && strlen(trim($request->getPost($this->_submitFieldName)))) {
            return true;
        } else {
            return false;
        }
    }
157113
public function upload()
    {
        // validate that all options properties was properly set to correct type.
        $this->validateOptionsProperties();
        // setup file extensions and mime types for validation. (in case that it was not set).
        $this->setupFileExtensionsMimeTypesForValidation();

        // verify that location where the uploaded file(s) will be moved to is writable.
        if (!is_dir($this->move_uploaded_to)) {
            $this->setErrorMessage(
                static::__('The target location where the uploaded file(s) will be moved to is not folder or directory.'),
                'RDU_MOVE_UPLOADED_TO_NOT_DIR',
                $this->move_uploaded_to
            );
            return false;
        } elseif (is_dir($this->move_uploaded_to) && !is_writable($this->move_uploaded_to)) {
            $this->setErrorMessage(
                static::__('The target location where the uploaded file(s) will be moved to is not writable. Please check the folder permission.'),
                'RDU_MOVE_UPLOADED_TO_NOT_WRITABLE',
                $this->move_uploaded_to
            );
            return false;
        } else {
            // solve the move uploaded to as a real path.
            $this->move_uploaded_to = realpath($this->move_uploaded_to);
        }

        if (isset($_FILES[$this->input_file_name]['name']) && is_array($_FILES[$this->input_file_name]['name'])) {
            // if multiple file upload.
            foreach ($_FILES[$this->input_file_name]['name'] as $key => $value) {
                $this->files[$this->input_file_name]['input_file_key'] = $key;
                $this->files[$this->input_file_name]['name'] = $_FILES[$this->input_file_name]['name'][$key];
                $this->files[$this->input_file_name]['type'] = (isset($_FILES[$this->input_file_name]['type'][$key]) ? $_FILES[$this->input_file_name]['type'][$key] : null);
                $this->files[$this->input_file_name]['tmp_name'] = (isset($_FILES[$this->input_file_name]['tmp_name'][$key]) ? $_FILES[$this->input_file_name]['tmp_name'][$key] : null);
                $this->files[$this->input_file_name]['error'] = (isset($_FILES[$this->input_file_name]['error'][$key]) ? $_FILES[$this->input_file_name]['error'][$key] : 4);
                $this->files[$this->input_file_name]['size'] = (isset($_FILES[$this->input_file_name]['size'][$key]) ? $_FILES[$this->input_file_name]['size'][$key] : 0);

                $result = $this->uploadSingleFile();

                if ($result == false && $this->stop_on_failed_upload_multiple === true) {
                    // it was set to sop on failed to upload multiple file. return false.
                    unset($result);
                    return false;
                }
            }// endforeach;
            unset($key, $value);
        } else {
            // if single file upload.
            $this->files[$this->input_file_name] = $_FILES[$this->input_file_name];
            $this->files[$this->input_file_name]['input_file_key'] = 0;

            $result = $this->uploadSingleFile();
        }

        if (isset($result) && $result == false && $this->stop_on_failed_upload_multiple === true) {
            // there is at lease one upload error and it was set to stop on error.
            unset($result);
            $this->clearUploadedAtTemp();
            return false;
        } elseif (count($this->error_messages) > 0 && $this->stop_on_failed_upload_multiple === true) {
            // there is at lease one upload error and it was set to stop on error.
            unset($result);
            $this->clearUploadedAtTemp();
            return false;
        }

        return $this->moveUploadedFiles();
    }
45461
public function isValid() {
		
		$file = $this -> getFile();

		$messages = [

			UPLOAD_ERR_FORM_SIZE 	=> 'File exceeds the maximum file size that was specified in the HTML form',
			UPLOAD_ERR_PARTIAL 		=> 'File was only partially uploaded',
			UPLOAD_ERR_NO_FILE		=> 'No file was uploaded',
			UPLOAD_ERR_NO_TMP_DIR	=> 'Missing a temporary folder',
			UPLOAD_ERR_CANT_WRITE	=> 'Failed to write file to disk',
			UPLOAD_ERR_EXTENSION	=> 'An extension stopped the file upload'
		];

		if(false === isset($messages[$file['error']])) {
			return true;
		}

		$this -> setMessage($messages[$file['error']]);

		return false;
	}
428596
public function isUploadedFile($path)
    {
        if (!$path) {
            return false;
        }
        if (mb_orig_strpos($path, $this->getUploadTempDir() . '/') !== 0) {
            return false;
        }
        foreach ($this->attrs->files as $file) {
            if ($file['tmp_name'] === $path) {
                return true;
            }
        }
        return false;
    }
1120751
protected function validateFileSize()
    {
        if (!is_numeric($this->max_file_size) && !is_int($this->max_file_size)) {
            // it is not set max file size limitation.
            return true;
        }

        if (is_array($this->files[$this->input_file_name]) && array_key_exists('size', $this->files[$this->input_file_name]) && $this->files[$this->input_file_name]['size'] > $this->max_file_size) {
            $this->setErrorMessage(
                sprintf(static::__('The uploaded file exceeds the max file size directive. (%s &gt; %s).'), $this->files[$this->input_file_name]['size'], $this->max_file_size),
                'RDU_1',
                $this->files[$this->input_file_name]['size'] . ' &gt; ' . $this->max_file_size,
                $this->files[$this->input_file_name]['name'],
                $this->files[$this->input_file_name]['size'],
                $this->files[$this->input_file_name]['type']
            );
            return false;
        } else {
            if (is_array($this->files[$this->input_file_name]) && array_key_exists('tmp_name', $this->files[$this->input_file_name]) && function_exists('filesize')) {
                if (filesize($this->files[$this->input_file_name]['tmp_name']) > $this->max_file_size) {
                    $this->setErrorMessage(
                        sprintf(static::__('The uploaded file exceeds the max file size directive. (%s &gt; %s).'), $this->files[$this->input_file_name]['size'], $this->max_file_size),
                        'RDU_1',
                        $this->files[$this->input_file_name]['size'] . ' &gt; ' . $this->max_file_size,
                        $this->files[$this->input_file_name]['name'],
                        $this->files[$this->input_file_name]['size'],
                        $this->files[$this->input_file_name]['type']
                    );
                    return false;
                }
            }
        }

        return true;
    }
374287
public function is_submitted() {
		$data = uix()->request_vars( 'post' );

		return isset( $data[ 'uixNonce_' . $this->id() ] ) && wp_verify_nonce( $data[ 'uixNonce_' . $this->id() ], $this->id() );
	}
39118
public function uploadFile()
    {
        if (!$this->request->files->has('file')) {
            return false;
        }
        $file   = $this->request->files->get('file');
        $upload = rtrim($this->uploadDir, '/');
        if (!is_dir($upload)) {
            mkdir($upload, 0777, true);
        }
        $file->move(realpath($upload), $file->getClientOriginalName());

        return sprintf('/%s/%s', pathinfo($upload, PATHINFO_BASENAME),
            pathinfo($file->getClientOriginalName(), PATHINFO_BASENAME));
    }
1193336
public function doUpload() {
        $result = false;
        
        if(is_array($this->fileArray['tmp_name'])) {
        	error_log('file array is in multi upload format, use doMultiUpload()');
        	return false;
        }
        
        $errno = $this->fileArray['error']; 
		if($errno == UPLOAD_ERR_OK) {

			if(!File::createFolder($this->uploadDir,true)) {
	        	error_log('Failed to create directory ' . $this->uploadDir);
	        	return false;
	        }
			
			if(is_uploaded_file($this->fileArray['tmp_name'])) {
				$result = move_uploaded_file($this->fileArray['tmp_name'], $this->uploadDir.$this->fileArray['name']);
			} else {
				$result = copy($this->fileArray['tmp_name'], $this->uploadDir.$this->fileArray['name']);
			}
			
			if($result) {
				$this->uploaded[] = $this->fileArray;
			
				//can't rely on browser to determine mime type, so do our own check.
				$this->setMimeType($this->uploadDir.$this->fileArray['name']);
			}
		} else {
			error_log($this->getErrMsg($errno));    
			$result = false;
		}
        
        return $result;
    }
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;
    }
111363
public function isImage()
	{
		$mime = $this->getMimeType();
		
		// The $imageMimes property contains an array of file extensions and
		// their associated MIME types. We will loop through them and look for 
		// the MIME type of the current SymfonyUploadedFile.
		foreach ($this->imageMimes as $imageMime)
		{
			if (in_array($mime, (array) $imageMime))
			{
				return true;
			}
		}

		return false;
	}
582190
public function canSubmit() {

		return 
			$this instanceof InputElement && isset($this->attributes['type']) && $this->attributes['type'] == 'submit' ||
			$this instanceof ImageElement ||
			$this instanceof SubmitInputElement ||
			$this instanceof ButtonElement && $this->attributes['type'] == 'submit';

	}
245501
function no_submit_button_pressed(){
        static $nosubmit = null; // one check is enough
        if (!is_null($nosubmit)){
            return $nosubmit;
        }
        $mform =& $this->_form;
        $nosubmit = false;
        if (!$this->is_submitted()){
            return false;
        }
        foreach ($mform->_noSubmitButtons as $nosubmitbutton){
            if (optional_param($nosubmitbutton, 0, PARAM_RAW)){
                $nosubmit = true;
                break;
            }
        }
        return $nosubmit;
    }
433502
public function isFile(): bool
    {
        if ($this->caching == false) {
            return is_file($this->getAbsoluteFilePath());
        }

        if ($this->isFile == null) {
            $this->isFile = is_file($this->getAbsoluteFilePath());
        }

        return $this->isFile;
    }
156485
public function save()
	{
		$result=true;
		foreach($this->files as $file)
		{
			if($this->confirmed($file))
				$result=$file->save() && $result;
		}
		return $result;
	}
579205
public function isDelete() {
		if ( isset( $_SERVER['REQUEST_METHOD'] ) ) {

			if ( $_SERVER['REQUEST_METHOD'] == 'DELETE' || ( isset( $_POST['_METHOD'] ) && $_POST['_METHOD'] == 'DELETE' ) ) {
				parse_str( file_get_contents( "php://input" ), $vars );

				if ( isset( $vars['_METHOD'] ) ) {
					unset( $vars['_METHOD'] );
				}

				$GLOBALS['_DELETE'] = $_DELETE = $vars;

				return TRUE;
			} else {
				return FALSE;
			}

		} else {
			return FALSE;
		}

	}
858332
public function hasFileUpload()
    {
        $returnValue = false;

		foreach($this->elements as $element){
			if($element instanceof tao_helpers_form_elements_File){
				 $returnValue = true;
				 break;
			}
		}

        return $returnValue;
    }