@param string $path
@param string $name
@param string $encoding
@param string $type
@param string $disposition

@return bool
192844
public function addAttachment(
        $path,
        $name = '',
        $encoding = 'base64',
        $type = 'application/octet-stream',
        $disposition = 'attachment'
    ) {
        $this->_aAttachments[] = [$path, $name, $encoding, $type, $disposition];
        $result = false;

        try {
            $result = parent::addAttachment($path, $name, $encoding, $type, $disposition);
        } catch (Exception $exception) {
        }

        return $result;
    }
250986
protected function _mkdir($path, $name) {
		$path = $path.DIRECTORY_SEPARATOR.$name;

		if (@mkdir($path)) {
			@chmod($path, $this->options['dirMode']);
			return $path;
		}

		return false;
	}
394462
function AddAttachment($path, $name = "", $encoding = "base64", $type = "application/octet-stream") {
      if(!@is_file($path))
      {
         $this->error_handler(sprintf("Could not find %s file on filesystem", $path));
         return false;
      }

      $filename = basename($path);
      if($name == "")
         $name = $filename;

      // Append to $attachment array
      $cur = count($this->attachment);
      $this->attachment[$cur][0] = $path;
      $this->attachment[$cur][1] = $filename;
      $this->attachment[$cur][2] = $name;
      $this->attachment[$cur][3] = $encoding;
      $this->attachment[$cur][4] = $type;
      $this->attachment[$cur][5] = false; // isStringAttachment

      return true;
   }
228285
public function offsetSet($name, $path)
    {
        if($path instanceof \Exedra\Path)
        {
            $this->pathRegistry[$name] = $path;

            return;
        }

        $path = $this->basePath.'/'.ltrim($path, '/\\');

        $this->pathRegistry[$name] = new static($path);
    }
806292
function getAttribute($id, $disposition = FILE_X509_ATTR_ALL, $csr = null)
    {
        if (empty($csr)) {
            $csr = $this->currentCert;
        }

        $attributes = $this->_subArray($csr, 'certificationRequestInfo/attributes');

        if (!is_array($attributes)) {
            return false;
        }

        foreach ($attributes as $key => $attribute) {
            if ($attribute['type'] == $id) {
                $n = count($attribute['value']);
                switch (true) {
                    case $disposition == FILE_X509_ATTR_APPEND:
                    case $disposition == FILE_X509_ATTR_REPLACE:
                        return false;
                    case $disposition == FILE_X509_ATTR_ALL:
                        return $attribute['value'];
                    case $disposition >= $n:
                        $disposition -= $n;
                        break;
                    default:
                        return $attribute['value'][$disposition];
                }
            }
        }

        return false;
    }
381839
protected function getMigrationFile($name, $path = false)
    {
        $path = $path ? $path : $this->migrationPath;
        return $path . DIRECTORY_SEPARATOR . $name . '.php';
    }
539225
function (type, disposition) {
        Header.isHeader(type) && (type = type.value);
        Header.isHeader(disposition) && (disposition = disposition.value);

        // validate that the content type exists
        if (!(type && _.isString(type))) { return; }

        var normalised = mimeFormat.lookup(type),
            info = {};

        _.assign(info, {
            type: normalised.type, // sanitised mime type base
            format: normalised.format, // format specific to the type returned
            name: DEFAULT_RESPONSE_FILENAME,
            ext: mimeType.extension(normalised.source) || E, // file extension from sanitised content type
            charset: normalised.charset || UTF8,

            // also storing some meta info for possible debugging
            _originalContentType: type, // the user provided mime type
            _sanitisedContentType: normalised.source, // sanitised mime type
            _accuratelyDetected: !normalised.orphan // this being true implies worse case (raw render)
        });

        // build the file name from extension
        info.filename = info.name;
        info.ext && (info.filename += (DOT + info.ext));

        return info;
    }
28293
public static String encodePath(String path, String encoding) throws UnsupportedEncodingException {
		return HierarchicalUriComponents.encodeUriComponent(path, encoding, HierarchicalUriComponents.Type.PATH);
	}
940470
public function setDisposition(string $dispositionType, $filename = null, $name = null)
    {
        if (!in_array($dispositionType, $this->dispositions)) {
            Checkers::notice('Unknown response type [' . $type . ']');
        } else {
            $this->disposition['type'] = $dispositionType;
        }
        if ($filename !== null) {
            $this->disposition['filename'] = (string) $filename;
        }
        if ($name !== null) {
            $this->disposition['name'] = (string) $name;
        }
        return $this;
    }
1202533
public static function fromLocalPath($path, $name = "")
    {
        if ($name == "") {
            $name = basename($path);
        }

        $part = new MimePartBinaryFile();
        $part->setTransformedBody(file_get_contents($path));
        $part->addHeader("Content-Disposition", "attachment; filename=\"" . $name . "\"");

        return $part;
    }
730986
public function saveFile ($path, $name, $contents)
    {
        $targetFile = $path . $name;

        $folder = pathinfo($targetFile, PATHINFO_DIRNAME);

        if(!is_dir($folder)) {
            echo $folder . '<br>';
            mkdir($folder, 0777, true);
        }

        if (!file_exists($targetFile)) {
            file_put_contents($targetFile, $contents);
            $this->log->append(sprintf('Saved \'%s\' to \'%s\'', $name, $path));
        } elseif ($this->getOverwrite()) {
            $existingFile = file_get_contents($targetFile);
            $newFile      = $this->keepUserAdditions($contents, $existingFile, $path, $name);

            file_put_contents($targetFile, $newFile);

            $this->log->appendExtended(sprintf('\'%s\' file existed and modified in \'%s\'', $name, $path));
        } else {
            $this->log->prepend(sprintf('*** You may need to manually change the \'%s\' file in the \'%s\' folder as the template might have changed since you started using it.', $name, $path));
        }
    }
841816
public function addEmbeddedImage(
        $path,
        $cid,
        $name = '',
        $encoding = 'base64',
        $type = 'application/octet-stream',
        $disposition = 'inline'
    ) {
        $this->_aAttachments[] = [
            $path,
            basename($path),
            $name,
            $encoding,
            $type,
            false,
            $disposition,
            $cid
        ];

        return parent::addEmbeddedImage($path, $cid, $name, $encoding, $type, $disposition);
    }
54308
protected function joinPathCE($dir, $name) {
		return (!$this->encoding)? $this->_joinPath($dir, $name) : $this->convEncOut($this->_joinPath($this->convEncIn($dir), $this->convEncIn($name)));
	}
848255
public static function send($file, $disposition = ResponseHeaderBag::DISPOSITION_ATTACHMENT, $fileName = null)
    {
        return MimeType::response($file, $disposition, $fileName)->send();
    }
996086
public function download(
        $file,
        string $name = null,
        array $headers = [],
        string $disposition = ResponseHeaderBag::DISPOSITION_ATTACHMENT
    ) : BinaryFileResponse {
        $response = new BinaryFileResponse($file, HttpResponse::HTTP_OK, $headers, true, $disposition);

        $response->prepare(HttpRequest::createFromGlobals());

        if ( ! is_null($name)) {
            $response = $response->setContentDisposition(
                $disposition,
                $name,
                iconv('UTF-8', 'ASCII//TRANSLIT', $name)
            );
        }

        return $this->createOnly ? $response : $response->send();
    }
1041792
public function Save ($path, $name = FALSE, $extension = FALSE)
	{
		
		// Set path/name variables
		
		if (!$this->setPath ($path))
		{
			return FALSE;
		}
		
		if ($name)
		{
			$this->name	= $name;
		}
		
		if ($extension)
		{
			$this->extension	= $extension;
		}
		
		$this->filename	= $this->name . '.' . $this->extension;
		
		// Get tmp path
		
		$tmpPath	= $this->tmpPath ();
		
		if (!$tmpPath)
		{
			return FALSE;
		}
		
		// Move the file
		
		if (!move_uploaded_file ($tmpPath, $this->path . $this->filename))
		{
			
			// Set error
			
			new \Sonic\Message ('error', 'Cannot save uploaded file!');
			
			// Return FALSE
			
			return FALSE;
			
		}
		
		// Return TRUE
		
		return TRUE;
		
	}
744974
public function store($name, $path)
    {
        $rawData = file_get_contents($path);

        $attachment = $this->client->post('attachments.json', [
            'query' => [
                'name' => $name,
            ],
            'body' => $rawData,
            'headers' => [
                'Content-Type' => mime_content_type($path),
                'Content-Length' => filesize($path),
            ],
        ]);

        return $this->response($attachment);
    }