Writes the content of the local file to the remote path

{@inheritDoc}

@param string $path Path to the remote file
@param string $local Path to the local file
@return void
@throws \Aimeos\MW\Filesystem\Exception If an error occurs
480586
public function writef( $path, $local )
	{
		if( ( $content = @file_get_contents( $local ) ) === false ) {
			throw new Exception( sprintf( 'Couldn\'t read file "%1$s"', $local ) );
		}

		$this->write( $path, $content );
	}
726725
public function write()
    {
        // If the local filesystem has the uploaded file
        if (file_exists($this->file->getRealPath()))
        {
            // Read the local uploaded file
            $file = file_get_contents($this->file->getRealPath());

            // Write it to the S3 location
            return $this->remote->write($this->attributes['upload_to'] . '/' . $this->attributes['filename'], $file, ['visibility' => 'public']);
        }

        throw new Exception('The uploaded file was not found on the filesystem');
    }
1324503
public void write(final Path path, final Writer<? super T> writer) {
		try {
			final File tempFile = createTempFile("__trial_meter__", ".xml");
			try {
				try (OutputStream out = new FileOutputStream(tempFile)) {
					write(out, writer);
				}

				move(tempFile.toPath(), path, REPLACE_EXISTING);
			} finally {
				deleteIfExists(tempFile.toPath());
			}
		} catch (IOException e) {
			throw new UncheckedIOException(e);
		}
	}
557639
public function writePath(array $path) {
        try {
            $this->writeShort(count($path));
            foreach ($path as $p) {
                $this->writeShort($p);
            }
        } catch (BinaryStreamAccessException $e) {
            $msg = "An error occured while writing the path.";
    		throw new QtiBinaryStreamAccessException($msg, $this, QtiBinaryStreamAccessException::PATH, $e);
        }
    }
1054182
public function write($path, $resource, Config $config)
    {
        $path = pathinfo($path)['filename'];

        return parent::write($path, $resource, $config);
    }
355428
public static void writeTo(String path) throws IOException, NoSuchMethodException, IllegalAccessException,
            InvocationTargetException {
        createXwpfDocumentIfNull();
        MsUtils.writeTo(xwpfDocument, path);
    }
834763
public function put($local, $remote)
    {
        foreach ($this->connections as $connection) {
            $connection->put($local, $remote);
        }
    }
199376
def copy_file_to_remote(self, local_path, remote_path):
        
        sftp_client = self.transport.open_sftp_client()
        LOG.debug('Copy the local file to remote. '
                  'Source=%(src)s. Target=%(target)s.' %
                  {'src': local_path, 'target': remote_path})
        try:
            sftp_client.put(local_path, remote_path)
        except Exception as ex:
            LOG.error('Failed to copy the local file to remote. '
                      'Reason: %s.' % six.text_type(ex))
            raise SFtpExecutionError(err=ex)
303638
protected function scpSend($local_path, $remote_path, $mode=0644)
    {
        if(@ssh2_scpSend($connection, $remote_path, $remote_path, $mode)){
            throw new \Exception("Could send file with scp: ".$local_path.' to '.$remote_path);
        }
    }
200025
public function createFile(string $path): File {
    $localFile = $this->instantiateFile($path);
    $localFile->create();
    return $localFile;
  }
1326531
def _file_write(path, content):
    '''
    
    '''
    with salt.utils.files.fopen(path, 'w+') as fp_:
        fp_.write(salt.utils.stringutils.to_str(content))
    fp_.close()
292916
public function addFromString($local, $contents)
    {
        $this->phar->addFromString(
            $local,
            $this->replaceValues($this->compactContents($local, $contents))
        );
    }
27630
def write_to_local(self, filepath_from, filepath_to, mtime_dt=None):
        """"""

        self.__log.debug("Writing R[%s] -> L[%s]." % (filepath_from, 
                                                      filepath_to))

        with SftpFile(self, filepath_from, 'r') as sf_from:
            with open(filepath_to, 'wb') as file_to:
                while 1:
                    part = sf_from.read(MAX_MIRROR_WRITE_CHUNK_SIZE)
                    file_to.write(part)

                    if len(part) < MAX_MIRROR_WRITE_CHUNK_SIZE:
                        break

        if mtime_dt is None:
            mtime_dt = datetime.now()

        mtime_epoch = mktime(mtime_dt.timetuple())
        utime(filepath_to, (mtime_epoch, mtime_epoch))
1218482
public function put($local_file, $remote_file, $mode=null)
    {

        if(!is_null($mode)){
            return $this->scpSend($local_path, $remote_path, $mode);
            return true;
        }
        $stream = @fopen("ssh2.sftp://".$this->sftp.$remote_file, 'w');

        if (! $stream){
            throw new \Exception("Could not open file: $remote_file");
        }

        $data_to_send = @file_get_contents($local_file);
        if ($data_to_send === false){
            throw new \Exception("Could not open local file: $local_file.");
        }

        if (@fwrite($stream, $data_to_send) === false){
            throw new \Exception("Could not send data from file: $local_file.");
        }

        @fclose($stream);

        return true;
    }
1312071
protected function writeImageFile(ImageInterface $image, ImagePathInterface $path) {
		$filename = sanitize_path(implode(DIRECTORY_SEPARATOR, [
		    $this->getOption('root'),
    		/**
    		 * The stack prefix is the part of the URL that is used to detect wich stack to trigger.
    		 * This implementation aims to store a file at the exact same URL so next requests could be served statically.
    		 */
		    $this->getOption('use_prefix', false) ? $path->getPrefix() : null,
		    $path->getPath(),
		]));
		$dirname = dirname($filename);
		if (!is_dir($dirname)) {
		    @mkdir($dirname, $this->getOption('mode', 0755), true);
			if (!is_dir($dirname)) {
    			throw new StorageBackendException(sprintf('Cannot create dir %s', $dirname), StorageBackendException::CANNOT_CREATE_DIR);
			}
		}
		if (!file_put_contents($filename, $image->getBinaryContent())) {
			throw new StorageBackendException(sprintf('Cannot write file %s', $filename), StorageBackendException::CANNOT_WRITE_FILE);
		}
	}
1369547
protected function writeContentSafe($path, $content)
    {
        $count = 0;
        $tmpFile = tempnam(dirname($path), basename($path));

        if (@file_put_contents($tmpFile, $content) === false) {
            throw new SystemException(Lang::get('system::lang.file.create_fail', ['name'=>$tmpFile]));
        }

        while (!@rename($tmpFile, $path)) {
            usleep(rand(50000, 200000));

            if ($count++ > 10) {
                throw new SystemException(Lang::get('system::lang.file.create_fail', ['name'=>$path]));
            }
        }

        File::chmod($path);

        /*
         * Compile cached file into bytecode cache
         */
        if (Config::get('cms.forceBytecodeInvalidation', false)) {
            if (function_exists('opcache_invalidate') && ini_get('opcache.enable')) {
                opcache_invalidate($path, true);
            }
            elseif (function_exists('apc_compile_file')) {
                apc_compile_file($path);
            }
        }
    }
440738
private static function writeStream(StreamInterface $stream, $path)
    {
        $dir = dirname($path);

        if (!is_dir($dir)) {
            mkdir($dir, 0777, true);
        }

        $handle = fopen($path, 'wb+');

        if (false === $handle) {
            throw new RuntimeException('Unable to write to designated path');
        }

        $stream->rewind();

        while (!$stream->eof()) {
            fwrite($handle, $stream->read(4096));
        }

        fclose($handle);
    }