Add file to be uploaded for request use POST
@param string $key field name.
@param string $file file path to be uploaded.
@param string $content file content, default to null and read from file.
172691
public function addPostFile($key, $file, $content = null)
    {
        $this->setMethod('POST');
        $this->setBody(null);
        if ($content === null && is_file($file)) {
            $content = @file_get_contents($file);
        }
        $this->_postFiles[$key] = [basename($file), $content];
    }
97897
protected function addUploadedFile($file)
    {
        $this->clear();

        $this->uploaded_file = $this->getFileManager()->make($file);

        // Get the original values
        $filename = $this->uploaded_file->getClientOriginalName();
        $content_type = $this->uploaded_file->getMimeType();

        // Set model values
        $this->instanceWrite('file_name', $filename);
        $this->instanceWrite('file_size', $this->uploaded_file->getSize());
        $this->instanceWrite('content_type', $content_type);
        $this->instanceWrite('updated_at', date('Y-m-d H:i:s'));
        $this->instanceWrite('queued_file', null);

        // Queue all styles for writing
        $this->setQueue('write', $this->styles);
    }
561941
public static void saveFile(File file, String content) throws IOException {
        saveFile(file, content, false);
    }
1146263
public function write($content) : void
    {
        $this->checkFile();
        $this->checkDir();

        file_put_contents($this->path, $content);
    }
1237936
public function setPost($key, $value)
    {
        $this->_POST = Hash::insert($this->_POST, $key, $value);
    }
1370268
public void addFilePart(final String fieldName, final InputStream stream, final String contentType)
        throws IOException
    {
        addFilePart(fieldName, stream, null, contentType);
    }
505293
public static function createFile($file, $content = '')
    {
        $folder = dirname($file);
        if (!is_dir($folder)) {
            self::createFolder($folder);
        }

        file_put_contents($file, $content);
    }
1338362
public function addPostField($key, $value)
    {
        $this->setMethod('POST');
        $this->setBody(null);
        if (!is_array($value)) {
            $this->_postFields[$key] = strval($value);
        } else {
            $value = $this->formatArrayField($value);
            foreach ($value as $k => $v) {
                $k = $key . '[' . $k . ']';
                $this->_postFields[$k] = $v;
            }
        }
    }
590468
public function put($file, $content, array $option = [])
    {
        if (isset($option['bucket'])) {
            $bucket = $option['bucket'];
        } else {
            $bucket = $this->config['bucket'];
        }

        $this->client->putObject(array(
            'Bucket' => $bucket,
            'Key'    => $file,
            'Body'   => $content
        ));
    }
418437
private void queueOrSubmitUpload(String key, File file) {
        if (mReadyToBroadcast) {
            submitUpload(key, file);
        } else {
            if (VERBOSE) Log.i(TAG, "queueing " + key + " until S3 Credentials available");
            queueUpload(key, file);
        }
    }
83059
public function addEmbeddedFile(string $file, string $content = null, string $contentType = null): MimePart
    {
        return $this->inlines[$file] = $this->createAttachment($file, $content, $contentType, 'inline')
            ->setHeader('Content-ID', $this->getRandomId());
    }
1195147
public function write($key, $content, $timestamp = null)
    {
        if (!isset($this->cacheDirectory)) {
            return;
        }

        $this->loadCacheMetaData();
        $this->metaData[$key] = $timestamp;
        $this->dirty = true;

        if (!is_dir($this->cacheDirectory)) {
            mkdir($this->cacheDirectory, 0775, true);
        }
        file_put_contents($this->cacheDirectory . '/' . $key, serialize($content));
    }
524155
public function input($file_content)
    {
        $this->file_content = $file_content;

        $this->parsed_content = (array) SymfonyYaml::parse($this->file_content);
    }
1173784
public function sendFile($file, $name=NULL, $contentType='application/octet-stream', $contentDisposition='attachment'){
        if($name == NULL){
            $name= basename($file);
        }
        header('Content-Description: File Transfer');
        header('Content-Type: '.$contentType);
        header('Content-Disposition: '.$contentDisposition.'; filename="'.$name.'"');
        header('Pragma: public');
        header('Content-Length: ' . filesize($file));
        readfile($file);        
    }
846990
private function createLockFile($content = null)
    {
        if ($this->lockFile) {
            if ($content === null || ! is_string($content)) {
                $content = $this->getId();
            }

            file_put_contents($this->lockFile, $content);
        }
    }
55061
public static function putContent($file, $content, $flags = 0)
    {
        $bytesWritten = @file_put_contents($file, $content, $flags);

        if (false === $bytesWritten) {
            throw new IOException(sprintf("Cannot put content to file %s", $file));
        }

        return $bytesWritten;
    }
946851
public static function generateFile($file, array $content) {
		$string = static::buildIniString($content);

		return (bool)file_put_contents($file, $string);
	}