Set upload directory

@author Vincent Chalamon <vincentchalamon@gmail.com>

@param string $uploadDir
@param string $webDir

@return MenuAdmin
351777
public function setUploadDir($uploadDir, $webDir)
    {
        $this->uploadDir = $uploadDir;
        $this->webDir    = $webDir;

        return $this;
    }
698907
protected function _setUploadDir($path = null) {
		$path = (string)$path;
		if (file_exists($path)) {
			$this->_pathUploadDir = $path;
		}
	}
653128
public function uploadOne(UploadedFile $file, $folder = null, $disk = 'public')
    {
        return $file->store($folder, ['disk' => $disk]);
    }
49843
public function setEnvironmentDir($environmentDir) {
		if($environmentDir[0] != "/") $environmentDir = BASE_PATH . '/' . $environmentDir;
		$this->environmentDir = realpath($environmentDir) ?: $environmentDir;
	}
1315556
protected function setRootDir(/*# string */ $rootDir)
    {
        // validate root directory
        if (!is_string($rootDir) || !is_dir($rootDir) || !is_readable($rootDir))
        {
            throw new InvalidArgumentException(
                Message::get(Message::CONFIG_DIR_INVALID, $rootDir),
                Message::CONFIG_DIR_INVALID
            );
        }
        $this->root_dir = rtrim($rootDir, '/\\');

        return $this;
    }
274881
static function getUploadDir($withUploadUrl = TRUE)
    {
        $dir = __DIR__ . '/../../../../web/';
        if (!is_dir($dir))
        {
            $dir = __DIR__ . '/../../../../../web';
            if (!is_dir($dir))
            {
                $dir = __DIR__ . '/../../../../../../web';
                if (!is_dir($dir))
                {
                    throw new \Exception('Upload dir not found');
                }
            }
        }
        if (!is_dir($dir . self::getUploadUrl()))
        {
            if (!is_writable($dir))
            {
                throw new \Exception($dir . ' is not writable');
            }
            else
            {
                mkdir($dir . self::getUploadUrl());
            }
        }
        return $withUploadUrl ? $dir . self::getUploadUrl() : $dir;
    }
1281866
def _set_upload_url(self):
        """"""
        # pylint: disable=protected-access
        self._upload_url = "/".join(
            [self.jss._url, self._url, self.resource_type, self.id_type,
             str(self._id)])
591182
def send_ftp(outdir):
    """"""
    print("Uploading the files in the " + outdir + "/ directory!\n")

    # Make sure there is actually a configuration file
    config_file_dir = os.path.join(cwd, "config.py")
    if not os.path.exists(config_file_dir):
        sys.exit(
            "There dosen't seem to be a configuration file. Have you run the init command?")
    else:
        sys.path.insert(0, cwd)
        try:
            from config import ftp_server, ftp_username, ftp_password, ftp_port, ftp_upload_path
        except:
            sys.exit(
                "The FTP settings could not be found. Maybe your config file is too old. Re-run 'blended init' to fix it.")

    server = ftp_server
    username = ftp_username
    password = ftp_password
    port = ftp_port

    ftp = FTP()
    ftp.connect(server, port)
    ftp.login(username, password)
    filenameCV = os.path.join(cwd, outdir)

    try:
        ftp.cwd(ftp_upload_path)
        placeFiles(ftp, filenameCV)
    except:
        ftp.quit()
        sys.exit("Files not able to be uploaded! Are you sure the directory exists?")

    ftp.quit()

    print("\nFTP Done!")
692020
public function getCurrentUploadDir()
    {
        if (! isset($this->currentUploadDir)) {
            $modelDir = $this->getIdentifier();
            $this->currentUploadDir = public_path($this->uploadDir).DIRECTORY_SEPARATOR.$modelDir.
                DIRECTORY_SEPARATOR.$this->getKey().DIRECTORY_SEPARATOR;
        }

        return $this->currentUploadDir;
    }
801130
func (c *MockCommunicator) UploadDir(dst string, src string) error {
	v, ok := c.UploadDirs[src]
	if !ok {
		return fmt.Errorf("Directory not found!")
	}

	if v != dst {
		return fmt.Errorf("expected: %q\n\ngot: %q\n", v, dst)
	}

	return nil
}
296688
public function setDir($sDir = '')
    {
        //  Reset the log exists var so that line() checks again
        $this->oLog->exists = false;

        // --------------------------------------------------------------------------

        if (!empty($sDir) && substr($sDir, 0, 1) === '/') {
            $this->oLog->dir = $sDir;
        } elseif (!empty($sDir)) {
            $this->oLog->dir = DEPLOY_LOG_DIR . $sDir;
        } else {
            $this->oLog->dir = DEPLOY_LOG_DIR;
        }
    }
1200506
public function getUploadDir( $default = null ) {

		$prop = $this->properties[ self::PROP_UPLOAD_DIR ];

		if( isset( $prop ) && strlen( $prop ) > 0 ) {

			return $prop;
		}

		return $default;
	}
275362
def upload_directory(self, directory, bucket, key, transfer_config=None, subscribers=None):
        '''  '''
        check_io_access(directory, os.R_OK)
        return self._queue_task(bucket, [FilePair(key, directory)], transfer_config,
                                subscribers, enumAsperaDirection.SEND)
885854
function setCurrentImportOption( array $upload ) {

		try {
			$this->setCurrentZip( $upload['file'] );
		} catch ( \Exception $e ) {
			return false;
		}

		$option = [
			'file' => $upload['file'],
			'url' => $upload['url'] ?? null,
			'file_type' => $upload['type'],
			'type_of' => self::TYPE_OF,
			'chapters' => [],
		];

		$xml = $this->getOpf();

		//Format manifest to array
		$this->parseManifestToArray( $xml );

		//Iterate each spine and get each manifest item in the order of spine
		foreach ( $xml->spine->children() as $item ) {
			/** @var \SimpleXMLElement $item */
			// Get attributes
			$id = '';

			foreach ( $item->attributes() as $key => $val ) {
				if ( 'idref' === $key ) {
					$id = (string) $val;
				}
			}

			//Check this manifest item exists or not
			if ( isset( $this->manifest[ $id ] ) ) {

				$href = (string) $this->manifest[ $id ]['href'];

				//Check manifest item is copyright or not
				if ( 'OEBPS/copyright.html' === $href ) {
					$this->pbCheck( $href );
				}

				// Set
				// Extract title from file
				$html = $this->getZipContent( $this->basedir . $href, false );
				$matches = [];
				preg_match( '/(?:<title[^>]*>)(.+)<\/title\s*>/isU', $html, $matches );
				$title = ( ! empty( $matches[1] ) ? wp_strip_all_tags( $matches[1] ) : $id );

				$option['chapters'][ $id ] = $title;
			}
		}

		return update_option( 'pressbooks_current_import', $option );
	}
1333491
public function compactFiles(array $files, $uploadDir)
    {
        if ($this->type !== self::TYPE_FILE) {
            throw FormFieldException::notAFileUpload($this->tagName);
        }

        if (empty($files)) {
            throw new NoFileUploadedException("Files are missing from payload");
        }

        foreach (UploadedFile::create($this->name, $files, $uploadDir) as $uploadedFile) {
            $this->files[] = $uploadedFile;
        }
    }
40292
public function upload(File $file, UploadedFile $upload, $contents)
    {
        $this->generateFilename($file);

        $method = 'write';

        if (is_resource($contents) && get_resource_type($contents) == 'stream') {
            $method = 'writeStream';
        }

        $meta = $this->adapter->{$method}($file->path, $contents, new Config());

        if (!$meta) {
            return false;
        }

        $this->meta = $meta;

        $this->generateUrl($file);

        return $file;
    }
863700
public function setConfigDir($configDir)
    {
        if (!is_dir($configDir)) {
            throw new \InvalidArgumentException(
                sprintf('Invalid Application Configuration Directory: %s', $configDir)
            );
        }

        $this->configDir = $configDir;

        return($this);
    }