Start file upload

@param string $fileName = 'upload'
@param string $rootDir  = NULL

@return bool
187512
public  function start(String $fileName = 'upload', String $rootDir = NULL) : Bool
    {
        $fileName = $this->settings['source'] ?? $fileName;
        $rootDir  = $this->settings['target'] ?? $rootDir ?? $this->uploadDirectory;

        if( ! is_dir($rootDir) ) 
        {
            mkdir($rootDir);
        }

        $extensions = $this->_separator('extensions');
        $mimes      = $this->_separator('mimes');

        $this->file = $fileName;
        $encryption = $this->settings['prefix']      ?? '';
        $name       = $_FILES[$fileName]['name']     ?? NULL;
        $source     = $_FILES[$fileName]['tmp_name'] ?? NULL;
        $root       = Base::suffix($rootDir, '/');     

        if( is_array($name) )
        {
            for( $index = 0; $index < count($name); $index++ )
            {
                $this->_upload($rootDir, $root, $source[$index], $name[$index], $extensions, $mimes, $encryption);
            }

            $return = true;
        }
        else
        {
            $return = $this->_upload($rootDir, $root, $source, $name, $extensions, $mimes, $encryption);
        }

        $this->_default();

        return $return;
    }
184549
protected boolean uploadDirectory(final String ftpServer, final String username, final String password,
                                      final String sourceDirectoryPath, final String targetDirectoryPath) {
        log.debug("FTP username: " + username);
        try {
            final FTPClient ftpClient = getFTPClient(ftpServer, username, password);

            log.info(String.format(UPLOAD_DIR_START, sourceDirectoryPath, targetDirectoryPath));
            uploadDirectory(ftpClient, sourceDirectoryPath, targetDirectoryPath, "");
            log.info(String.format(UPLOAD_DIR_FINISH, sourceDirectoryPath, targetDirectoryPath));

            ftpClient.disconnect();
            return true;
        } catch (Exception e) {
            log.debug(e);
            log.error(String.format(UPLOAD_DIR_FAILURE, sourceDirectoryPath, targetDirectoryPath));
        }

        return false;
    }
241297
public function addFile($filename, $root = JPATH_ROOT, $strip = 0)
	{
		return $this->add(file_get_contents($filename), $root, $strip);
	}
451510
public function uploadUrlForFile($filename) {
	    $prefix = StorageSettings::prefix(null);
        $parts = explode('/', $filename);
        $bucketFilename = array_pop($parts);

		if($this->client && $this->client->enabled()) {
			try {
				return $this->client->uploadUrl($prefix.$bucketFilename, StorageSettings::privacy(), StorageSettings::cacheControl(), StorageSettings::expires());
			}
			catch(StorageException $ex) {
				Logger::error('Generate File Upload URL Error', ['exception' => $ex->getMessage()]);
			}
		}

		return null;
	}
175747
public function start(string $directory, string $stackName, array $serviceNames = null, bool $upgrade = false, bool $forcedUpgrade = false) {
		if($serviceNames === null)
			$serviceNames = [];
		if( !is_array($serviceNames) )
			$serviceNames = [$serviceNames];

		$url = $this->getUrl();
		$account = $this->account;
		if ($this->cliMode && $account instanceof RancherCliAccount)
            $command = [
                $account->getCliVersion(),
                'up',
                "-f",
                "$directory/docker-compose.yml",
                '--rancher-file',
                "$directory/rancher-compose.yml",
                '-s',
                $stackName,
                '-d',
                '-p'
            ];
		else
            $command = [
                $account->getRancherCompose(),
                "-f",
                "$directory/docker-compose.yml",
                '-r',
                "$directory/rancher-compose.yml",
                '-p',
                $stackName,
                'up',
                '-d',
                '-p'
            ];

		if($upgrade)
			$command = array_merge($command, ['--upgrade']);

		if($forcedUpgrade)
			$command = array_merge($command, ['--force-upgrade']);

		$command = array_merge($command, $serviceNames);

		$process = ProcessBuilder::create( $command )
			->setTimeout(null)
			->addEnvironmentVariables([
				'RANCHER_URL' => $url,
				'RANCHER_ACCESS_KEY' => $this->account->getKey(),
				'RANCHER_SECRET_KEY' => $this->account->getSecret(),
			])->getProcess();

		$ran = $this->processHelper->run($this->output, $process, null, null, OutputInterface::VERBOSITY_NORMAL);
		if( $ran->getExitCode() != 0 )
			throw new StartFailedException("Command ".$ran->getCommandLine());
	}
624395
public function move(string $directory, string $filename='')
  {
    # If no filename is provided, assume the incoming name
    if (empty($filename)) $this->setFilename( $this->getName() );

    # Move the file
    $ok = \move_uploaded_file($this->getTmpName(), $destination . DIRECTORY_SEPARATOR . $filename );

    # Set property
    $this->setIsMoved($ok);

    return $ok;
  }
697501
public function uploadShopImage($filePath, $fileName = null)
    {
        $fileName === null && $fileName = pathinfo($filePath, PATHINFO_BASENAME);
        $result = $this->httpRaw(self::WECHAT_SHOP_IMAGE_UPLOAD_URL .
            'access_token=' . $this->getAccessToken() . '&filename=' . $fileName, file_get_contents($filePath));
        return isset($result['errmsg']) && $result['errmsg'] == 'success' ? $result['image_url'] : false;
    }
1151541
public function saveBackupTo($filename)
    {
        $result                                   = false;
        $headersBackup                            = $this->defaultHttpHeaders;
        $this->defaultHttpHeaders['Accept']       = '*/*';
        $this->defaultHttpHeaders['Content-Type'] = 'application/x-winstrom-backup';
        $this->performRequest('backup', 'GET');
        $this->defaultHttpHeaders                 = $headersBackup;

        if ($this->lastResponseCode == 200) {
            if (file_put_contents($filename, $this->lastCurlResponse)) {
                $result = true;
            }
        }
        $this->defaultHttpHeaders = $headersBackup;
        return $result;
    }
746697
public static boolean start(com.sun.javadoc.RootDoc root) {
        try {
            BeanDocDoclet doclet = new BeanDocDoclet(root);
            doclet.start();
        }
        catch (Exception e) {
            e.printStackTrace();
            return false;
        }

        return true;
    }
301216
public function openFile($filename)
    {
        $this->file = file_get_contents($this->absolutizePath($filename));
        $this->filepath = $filename;
    }
68223
public static function fromFile($filename, $width, $height = 0)
    {
        
        $urlizer = new Urlizer($filename);

        static::configureUrlizer($urlizer);

        // If the filename is not initialized by '/', this is a fullpath
        
        if (strpos($filename, '/') !== 0) {

            $filename = $urlizer->getPublicFilename();
        }

        try {

            $thumb = new static($filename, $width, $height);

        } catch (\InvalidArgumentException $e) {

            if (static::$config['fallback'] === null) {

                throw $e;
            }

            return static::$config['fallback'];
        }

        $basename = $thumb->generateBasename();

        $filename = $urlizer->buildThumbFilename($basename);

        $thumb->getCache($filename);

        return $urlizer->buildThumbUrl($basename);
    }
451691
protected function _upload($rootDir, $root, $src, $nm, $extensions, $mimes, $encryption)
    {
        if( empty($nm) )
        {
            return ! $this->manuelError = 4;
        }   
        
        if( $convertName = ($this->settings['convertName'] ?? NULL) )
        {
            # 5.4.3[edited] 
            if( $convertName === true )
            {
                $nm = Converter::slug($nm, true);
            }
            else
            {
                $nm = $convertName . $this->getFileExtension($nm);
            }
        }

        if( empty($encryption) )
        {
            if( $this->settings['encode'] ?? NULL )
            {
                $encryption = $this->_encode();
            }
            else
            {
                if( is_file($root.$nm) )
                {
                    $encryption = $this->_encode();
                }
            }
        }

        $encryptionName = $encryption . $nm;
        $target         = $root . $encryptionName;

        if( is_array($_FILES[$this->file]['name']) )
        {
            $this->encodeName = Arrays\AddElement::last((array) $this->encodeName, $encryptionName);
            $this->path       = Arrays\AddElement::last((array) $this->path      , $target        );     
        }
        else
        {
            $this->encodeName = $encryptionName;
            $this->path       = $target;
        }

        if( ! empty($extensions) && ! in_array(pathinfo($nm, PATHINFO_EXTENSION), $extensions) )
        {
            return $this->extensionControl = $this->getLang['upload:extensionError'];
        }
        elseif( ! empty($mimes) && ! in_array(Mime::type($src), $mimes) )
        {
            return $this->extensionControl = $this->getLang['upload:mimeError'];
        }
        elseif( ! empty($maxsize = Converter::toBytes($this->settings['maxsize'] ?? 0)) && $maxsize < filesize($src) )
        {
            return $this->manuelError = 10;
        }
        else
        {
            if( ! is_file($rootDir) )
            {
                return move_uploaded_file($src, $target);
            }
            else
            {
                return ! $this->manuelError = 9;
            }
        }
    }
229849
public function createFolder( $folderName )
	{
		$this->connection->checkConnection();
		return (bool) ftp_mkdir( $this->connection->getResource(), $folderName );
	}
640429
public function start() {
        $ci = 0;
        echo '<table id="uuresults" class="generaltable boxaligncenter flexible-wrap" summary="'.get_string('uploadusersresult', 'tool_uploaduser').'">';
        echo '<tr class="heading r0">';
        echo '<th class="header c'.$ci++.'" scope="col">'.get_string('status').'</th>';
        echo '<th class="header c'.$ci++.'" scope="col">'.get_string('uucsvline', 'tool_uploaduser').'</th>';
        echo '<th class="header c'.$ci++.'" scope="col">ID</th>';
        echo '<th class="header c'.$ci++.'" scope="col">'.get_string('username').'</th>';
        echo '<th class="header c'.$ci++.'" scope="col">'.get_string('firstname').'</th>';
        echo '<th class="header c'.$ci++.'" scope="col">'.get_string('lastname').'</th>';
        echo '<th class="header c'.$ci++.'" scope="col">'.get_string('email').'</th>';
        echo '<th class="header c'.$ci++.'" scope="col">'.get_string('password').'</th>';
        echo '<th class="header c'.$ci++.'" scope="col">'.get_string('authentication').'</th>';
        echo '<th class="header c'.$ci++.'" scope="col">'.get_string('enrolments', 'enrol').'</th>';
        echo '<th class="header c'.$ci++.'" scope="col">'.get_string('suspended', 'auth').'</th>';
        echo '<th class="header c'.$ci++.'" scope="col">'.get_string('delete').'</th>';
        echo '</tr>';
        $this->_row = null;
    }
832732
public function resolveFile($fileName, $rootDir = null)
    {
        if ($rootDir === null) {
            return $this->fileUtils->resolveFile($this->basedir, $fileName);
        } else {
            return $this->fileUtils->resolveFile($rootDir, $fileName);
        }
    }
245318
public function create($filename, $width, $height = null)
    {
        try {
            $image = app('image')->make($this->file->realPath)
                ->fit($width, ($height ?: $width))
                ->encode();

            $this->file->storage->put($this->file->path($filename), $image);
        } catch (NotReadableException $e) {
            return null;
        }

        return $this->file->storage->url($this->file->path($filename));
    }
444829
private function setFilesystemRootDir($rootDir, ContainerBuilder $container)
    {
        $definition = $container->getDefinition($this->getAlias() . '.filesystem');

        $definition->replaceArgument(0, $rootDir);
    }