Upload a remote file into storage.

@param string $url    The url to the remote file to upload.
@param string $target The path to the file to store.

@return bool
966238
public function remoteUpload($url, $target)
	{
		$tmp_name = md5($url);
		$tmp_path = Storage::config('tmp_path').'/'.$tmp_name;
		
		if (!$this->remoteDownload($url, $tmp_path)) {
			return false;
		}
		
		return $this->upload($tmp_path, $target);
	}
1072034
public function copy($source, $target) {
        // using mark.
        if ('@' == $source[0]) $source = $this->as($source);
        if ('@' == $target[0]) $target = $this->as($target);

        // copy file.
        if (is_file($source)) return copy($source, $target);

        // copy directory.
        $handle = opendir($source);
        while (false !== ($name = readdir($handle))) {
            if ('.' == $name or '..' == $name) continue;
            $subsource = $source.self::DS.$name;
            $subtarget = $target.self::DS.$name;
            if (!$this->copy($subsource, $subtarget)) return false;
        }
        closedir($handle);
        return true;
    }
1023729
function setTarget($target = null, $preserveHost = true)
    {
        $target = (string) $target;
        if (empty($target) && $target !== "0")
            $target = '/';
        
        // validate uri
        if (parse_url($target) === false)
        {
            $target = rawurlencode($target);

            /*
            throw new \InvalidArgumentException(sprintf(
                'Malformed URI: (%s).'
                , $target
            ));
            */
        }

        
        $this->target_uri = (string) $target;
        return $this;
    }
1327965
public function from($url)
	{
		$this->opts['target'] = $this->client->getDatabaseUri();
		$this->opts['source'] = $url;
		return $this->_launch();
	}
421130
public function uploadFile($sourcePath, $targetPath, $publicAccess = true, $allowRewriteFile = false)
	{
		// check if the file does not already exists, if exist, don't upload
		if ($allowRewriteFile !== true && $this->isFile($targetPath)) {
			return false;
		}
		return $this->s3Client->putObject(array(
			'Bucket'     => $this->getBucket(),
			'Key'        => $targetPath,
			'SourceFile' => $sourcePath,
			'ACL'        => $publicAccess ? self::PUBLIC_READ : self::PRIVATE_ACCESS
		));
	}
186018
protected function loadFromUrl($url)
    {
        $url = $this->overrideUrl($url);
        $this->log->debug("Load from url $url");
        $this->initCurl();
        curl_setopt($this->curl, CURLOPT_URL, $url);
        if (!$data = $this->getDataFromCurl()) {
            return false;
        }

        // fix encoding
        $data = iconv('ISO-8859-15', 'UTF-8', $data);

        // validate data through parser
        if (!$this->isDataValid($data)) {
            $this->addError($url, 'Data not valid according to parser');

            return false;
        }

        // save result to disk
        $this->saveToCache($data);

        return true;
    }
295752
public function upload($targetDirectory = null) {
		$helper = new FileUpload();

		if ($targetDirectory !== null) {
			$helper->withTargetDirectory($this->getStoragePath($targetDirectory));
		}

		return $helper;
	}
279039
public function copy($target) {
        if (!parent::copy($target))
            return false;
        return copy($this->fileSource, $target);
    }
309837
public function upload($path, $target)
	{
		$success = false;

		$dir = dirname($target);

		if (!is_dir($dir))
		{
			if (!$this->makeDirectory($dir))
			{
				return $success;
			}
		}

		if (is_writeable($dir) && move_uploaded_file($path, $target))
		{
			if ($this->setPermissions($target))
			{
				$success = true;
			}
		}

		return $success;
	}
1248798
public function write($target) {
		$target = $this->escapePath($target);
		// since returned stream is closed by the caller we need to create a new instance
		// since we can't re-use the same file descriptor over multiple calls
		$connection = $this->getConnection();

		$fh = $connection->getFileInputStream();
		$connection->write('put ' . $this->system->getFD(4) . ' ' . $target);
		$connection->write('exit');

		// use a close callback to ensure the upload is finished before continuing
		// this also serves as a way to keep the connection in scope
		return CallbackWrapper::wrap($fh, null, null, function () use ($connection, $target) {
			$connection->close(false); // dont terminate, give the upload some time
		});
	}
1023458
function MoveTo($targetFolder, $targetFilename = '')
    {
        if (!$targetFilename)
            $targetFilename = $this->Filename();
        
        $destination = Path::Combine($targetFolder, $targetFilename);
        $result = @move_uploaded_file($this->TempPath(), $destination);
        if (!$result)
            throw new \Exception('Uploaded file could not be moved to target');
    }
1104183
public function storeFile($input = null, $target)
    {
        // The input name and target path must be defined
        if (!isset($input) || !isset($target)) {
            throw new \InvalidArgumentException('Undefined input name or target', 400);
        }

        // Move the uploaded file
        $result = move_uploaded_file($_FILES[$input]['tmp_name'], $target);

        // Check if the file was stored
        if (!$result) {
            throw new \InvalidArgumentException('The file could not be stored', 500);
        }

        // Return the file info
        return $result;
    }
177976
protected function redirectAddAllRemainingInGlobalGet (& $targetUrl) {
		if ($this->requestGlobalGet) {
			$amp = $this->getQueryStringParamsSepatator();
			//foreach ($this->requestGlobalGet as $paramName => & $paramValue)
			//	$paramValue = rawurldecode($paramValue);
			$questionMarkDelimiter = mb_strpos($targetUrl, '?') === FALSE ? '?' : $amp;
			$targetUrl .= $questionMarkDelimiter . str_replace(
				'%2F', '/', 
				http_build_query($this->requestGlobalGet, '', $amp, PHP_QUERY_RFC3986)
			);
		}
	}
1337156
private function link(string $source, string $target): bool
    {
        if (!@link($source, $target)) {
            $message = 'Could not create link.';
            if ($error = error_get_last()) {
                $message .= sprintf(' Errno: %d; %s', $error['type'], $error['message']);
            }
            throw new FileException($message);
        }

        return true;
    }
254160
def upload_file(self, remote, local):
        
        file = open(local, 'rb')
        try:
            self.upload(remote, file)
        finally:
            file.close()
1168696
static public function submit( $url )
	{
		if( $url instanceof ADT_URL )
			$url	= (string) $url;
		if( !is_string( $url ) )
			throw new InvalidArgumentException( 'URL must be string or instance of ADT_URL' );
		try
		{
			Net_Reader::readUrl( self::$baseUrl.urlencode( $url ) );
		}
		catch( Exception $e )
		{
			self::$lastError	= $e->getMessage();
			return FALSE;
		}
		return TRUE;
	}
15239
public function put($url, $data = array())
    {
        if (is_array($url)) {
            $data = $url;
            $url = $this->baseUrl;
        }
        $this->setUrl($url);
        $this->setOpt(CURLOPT_CUSTOMREQUEST, 'PUT');
        $put_data = $this->buildPostData($data);
        if (empty($this->options[CURLOPT_INFILE]) && empty($this->options[CURLOPT_INFILESIZE])) {
            if (is_string($put_data)) {
                $this->setHeader('Content-Length', strlen($put_data));
            }
        }
        if (!empty($put_data)) {
            $this->setOpt(CURLOPT_POSTFIELDS, $put_data);
        }
        return $this->exec();
    }