public function addFile(string $filename, string $field, array $crop = null): bool
    {
        if (!file_exists($filename)) {
            throw new \RuntimeException("File not found: {$filename}");
        }

        // Prepare upload data for later save
        $data = [
            'name' => basename($filename),
            'type' => Utils::getMimeByLocalFile($filename),
            'size' => filesize($filename),
        ];

        $this->addFileInternal($field, $data['name'], $data, $crop);

        return true;
    }
public function addFile(string $filename, string $field, array $crop = null): bool
    {
        if (!file_exists($filename)) {
            throw new \RuntimeException("File not found: {$filename}");
        }

        // Prepare upload data for later save
        $data = [
            'name' => basename($filename),
            'type' => Utils::getMimeByLocalFile($filename),
            'size' => filesize($filename),
        ];

        $this->addFileInternal($field, $data['name'], $data, $crop);

        return true;
    }
public function addFile ( string $ filename , string $ field , array $ crop = null ) : bool { if ( ! file_exists ( $ filename ) ) { throw new \ RuntimeException ( "File not found: {$filename}" ) ; } // Prepare upload data for later save $ data = [ 'name' => basename ( $ filename ) , 'type' => Utils :: getMimeByLocalFile ( $ filename ) , 'size' => filesize ( $ filename ) , ] ; $ this -> addFileInternal ( $ field , $ data [ 'name' ] , $ data , $ crop ) ; return true ; }
Add existing file to the form flash.

@param string $filename
@param string $field
@param array $crop
@return bool
Add existing file to the form flash .