Upload file By content.

@param File   $file
@param string $content

@return \Railken\Lem\Contracts\ResultContract
6339
public function uploadFileByContent(File $file, string $content)
    {
        $dir = sys_get_temp_dir();

        $tmp = $dir.'/'.Uuid::uuid4()->toString();

        file_put_contents($tmp, $content);

        $filename = $file->name;

        if (!$filename) {
            $filename = Uuid::uuid4()->toString().'.'.$this->guessExtension($tmp);
        }

        $filename = $dir.'/'.$filename;

        rename($tmp, $filename);

        return $this->uploadFileFromFilesystem($file, $filename);
    }
1251770
public function createFile($filename, $content)
    {
        if (false === $this->createDirectory(dirname($filename))) {
            return false;
        }

        Silencer::call('file_put_contents', $filename, $content);
        Silencer::call('chmod', $filename, 0755);

        return true;
    }
781342
public function put($filename, $content)
    {
        // Merge existing content to new content
        if (file_exists($this->cacheDir . $filename) && file_get_contents($this->cacheDir . $filename) != '') {
            $cachedContent = $this->get($filename);
            $content       = array_merge($content, $cachedContent);
        }
        $this->files->put($this->cacheDir . $filename, json_encode($content));
    }
360342
public function save($filename, $content) {
        if ($this->driver) {
            return $this->driver->save($filename, $content);
        }

        return false;
    }
1039174
public function update(FileRequest $request, File $file)
    {
        $file->update($request->all());
        
        return $this->makeRedirect(true, 'admin.files.index', __('msg.update'));
    }
684447
public static function append($file = false, $content = false) {

        if ($file && $content) {

            if (file_put_contents($file, $content, FILE_APPEND)) {

                return true;
            }
        }

        return false;
    }
1222011
public function upload($file)
    {
        $this->filename = $this->getRandomFilename();
        $this->image = Image::make(Input::file($file)->getRealPath());

        return $this;
    }
789075
public function upload($file)
    {
        $zip = new Zip();
        $zip->addFile($file);

        $response = $this->browser->request('POST', 'file', json_encode(array('file' => base64_encode($zip->getContent()))));
        $content  = json_decode($response->getContent(), true);

        if (!isset($content['value'])) {
            throw new LibraryException('Malformed expression, no key "value" in response: '.$response->getContent());
        }

        $file = $content['value'];

        $this->type($file);

        return $file;
    }
4215
public function upload(UploadedFile $file)
    {
        self::$generic_file->moveUploadedFile(new File($file,
            $file->getClientOriginalName()), null, $this);

        return $this;
    }
699815
public static function newDocumentFile($file, $contentType = null) 
    {
        $documentID = self::createDocumentWrapper(
            file_get_contents($file), $contentType
        );
        return new phpQueryObject($documentID);
    }
971968
public function append($filename,$content,$type=''){
        if($old_content = $this->read($filename,$type)){
            $content =  $old_content.$content;
        }
        return $this->put($filename,$content,$type);
    }
1300354
public function write($file, $content, $type='sandbox')
	{
		$url = 'https://api-content.dropbox.com/1/files_put/';
		$result = $this->doOAuthCall($url,'PUT',null,$type,$file,$content);
		$result_body = json_decode($result['body'],true);
		if (!array_key_exists('error', $result_body)) {
			return $result_body;
		} else {
			trigger_error(sprintf(self::E_APIERROR, $result_body['error']));
			return false;
		}
	}
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];
    }
972496
public function uploadFile(File $file, $raw_file)
    {
        $result = new Result();

        if (file_exists($raw_file)) {
            return $this->uploadFileFromFilesystem($file, $raw_file);
        }

        return $result;
    }
250441
protected function write($content, $file)
    {
        if (file_exists($file)) { // Do not create a new file
            return file_put_contents($file, $content) !== false;
        }

        return false;
    }
187132
public function upload($file = null)
    {

        if (empty($file) || !is_array($file)) return false;

        $this->u_tmp_name  = $file['tmp_name'];
        $this->u_name      = $file['name'];
        $this->u_size      = $file['size'];
        $this->u_mime_type = $file['type'];
        $this->u_error     = isset($file['error']) ? $file['error'] : null;

        if ($this->u_error) {
            throw new FileException("File couldn't be uploaded reason " . FileException::$upload_errors[$this->u_error], Config::get('file_error'), Config::get('error_lvl_low'), __FILE__, __LINE__);
        }

        $this->_get_file_extension();

        return true;
    }
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);
    }