Uploads the base files (and if necessary, the current ones as well).
542568
def UploadBaseFiles(self, issue, rpc_server, patch_list, patchset, options,
											files):
		""""""

		def UploadFile(filename, file_id, content, is_binary, status, is_base):
			"""Uploads a file to the server."""
			set_status("uploading " + filename)
			file_too_large = False
			if is_base:
				type = "base"
			else:
				type = "current"
			if len(content) > MAX_UPLOAD_SIZE:
				print ("Not uploading the %s file for %s because it's too large." %
							(type, filename))
				file_too_large = True
				content = ""
			checksum = md5(content).hexdigest()
			if options.verbose > 0 and not file_too_large:
				print "Uploading %s file for %s" % (type, filename)
			url = "/%d/upload_content/%d/%d" % (int(issue), int(patchset), file_id)
			form_fields = [
				("filename", filename),
				("status", status),
				("checksum", checksum),
				("is_binary", str(is_binary)),
				("is_current", str(not is_base)),
			]
			if file_too_large:
				form_fields.append(("file_too_large", "1"))
			if options.email:
				form_fields.append(("user", options.email))
			ctype, body = EncodeMultipartFormData(form_fields, [("data", filename, content)])
			response_body = rpc_server.Send(url, body, content_type=ctype)
			if not response_body.startswith("OK"):
				StatusUpdate("  --> %s" % response_body)
				sys.exit(1)

		# Don't want to spawn too many threads, nor do we want to
		# hit Rietveld too hard, or it will start serving 500 errors.
		# When 8 works, it's no better than 4, and sometimes 8 is
		# too many for Rietveld to handle.
		MAX_PARALLEL_UPLOADS = 4

		sema = threading.BoundedSemaphore(MAX_PARALLEL_UPLOADS)
		upload_threads = []
		finished_upload_threads = []
		
		class UploadFileThread(threading.Thread):
			def __init__(self, args):
				threading.Thread.__init__(self)
				self.args = args
			def run(self):
				UploadFile(*self.args)
				finished_upload_threads.append(self)
				sema.release()

		def StartUploadFile(*args):
			sema.acquire()
			while len(finished_upload_threads) > 0:
				t = finished_upload_threads.pop()
				upload_threads.remove(t)
				t.join()
			t = UploadFileThread(args)
			upload_threads.append(t)
			t.start()

		def WaitForUploads():			
			for t in upload_threads:
				t.join()

		patches = dict()
		[patches.setdefault(v, k) for k, v in patch_list]
		for filename in patches.keys():
			base_content, new_content, is_binary, status = files[filename]
			file_id_str = patches.get(filename)
			if file_id_str.find("nobase") != -1:
				base_content = None
				file_id_str = file_id_str[file_id_str.rfind("_") + 1:]
			file_id = int(file_id_str)
			if base_content != None:
				StartUploadFile(filename, file_id, base_content, is_binary, status, True)
			if new_content != None:
				StartUploadFile(filename, file_id, new_content, is_binary, status, False)
		WaitForUploads()
1181627
function (files) {
      UI.widgets.uploadFiles(kb.fetcher, files, subject.uri, subject.uri, function (file, uri) {
        // A file has been uploaded
        let destination = kb.sym(uri)
        console.log(' Upload: put OK: ' + destination)
        kb.add(subject, ns.ldp('contains'), destination, subject.doc())
        mainTable.refresh()
      })
    }
785280
public function saveFiles(&$current_model)
    {
        foreach ($current_model->getAttributes() as $attribute => $value){
            if($current_model->hasValidator('image', $attribute)) {
                $current_model->$attribute = UploadedFile::getInstance($current_model, $attribute);
                if($current_model->$attribute && $current_model->validate([$attribute])){
                    $current_model->$attribute = Image::upload($current_model->$attribute, $current_model::SLUG);
                }
                else{
                    $current_model->$attribute = $current_model->isNewRecord ? '' : $current_model->oldAttributes[$attribute];
                }
            }elseif ($current_model->hasValidator('file', $attribute)){
                if($fileInstanse = UploadedFile::getInstance($current_model, $attribute)) {
                    $current_model->$attribute = Upload::file($fileInstanse, $current_model::SLUG);
                }else{
                    $current_model->$attribute = $current_model->isNewRecord ? '' : $current_model->oldAttributes[$attribute];
                }
            }
        }
    }
1356417
def put_files(self, files, content_type=None, compress=None, cache_control=None, block=True):
    
    for path, content in tqdm(files, disable=(not self.progress), desc="Uploading"):
      content = compression.compress(content, method=compress)
      self._interface.put_file(path, content, content_type, compress, cache_control=cache_control)
    return self
1205837
protected function handleUpload()
    {
        $this->uploadedField = array_keys($_FILES)[0];
        //check if any uploaded file for a defined field
        $this->uploadOk = $this->checkUpload();
        if(!$this->uploadOk) {
            return;
        }
        //exec upload
        $this->uploadOk = $this->uploadFields[$this->uploadedField]->handleUpload($this->uploader);
        if(!$this->uploadOk) {
            return;
        }
        //outputs post processing
        $outputs = $this->uploadFields[$this->uploadedField]->getOutputsFiles();
        foreach($this->uploadFieldsDefinitions[$this->uploadedField]['outputs'] as $output => $outputDefinition) {
            if(isset($outputDefinition['processor'])) {
                $this->{$outputDefinition['processor']}($outputs[$output]['path']);
            }
        }
    }
926975
protected void addFileInput(CmsFileInput fileInput) {

        // add the files selected by the user to the list of files to upload
        if (fileInput != null) {
            addFiles(Arrays.asList(fileInput.getFiles()));
        } else {
            loadAndShow();
        }
    }
865653
def files(self, data):
        """"""
        current_files = self.files
        if current_files:
            raise RuntimeError('Can not update existing files.')
        for key in data:
            current_files[key] = data[key]
1334265
def upload_files(self, abspaths, relpaths, remote_objects):
        
        for relpath in relpaths:
            abspath = [p for p in abspaths if p[len(self.file_root):] == relpath][0]
            cloud_datetime = remote_objects[relpath] if relpath in remote_objects else None
            local_datetime = datetime.datetime.utcfromtimestamp(os.stat(abspath).st_mtime)

            if cloud_datetime and local_datetime < cloud_datetime:
                self.skip_count += 1
                if not self.quiet:
                    print("Skipped {0}: not modified.".format(relpath))
                continue
            if relpath in remote_objects:
                self.update_count += 1
            else:
                self.create_count += 1
            self.upload_file(abspath, relpath)
252774
def upload_files(self, file_list):
        
        counter = 0
        files_to_upload = list(set(file_list) - set(self.uploaded_files)) # In case restoring from previous session
        try:
            for f in files_to_upload:
                with open(config.get_storage_path(f), 'rb') as file_obj:
                    response = config.SESSION.post(config.file_upload_url(), files={'file': file_obj})
                    if response.status_code == 200:
                        response.raise_for_status()
                        self.uploaded_files.append(f)
                        counter += 1
                        config.LOGGER.info("\tUploaded {0} ({count}/{total}) ".format(f, count=counter, total=len(files_to_upload)))
                    else:
                        self.failed_uploads[f] = response._content.decode('utf-8')
        finally:
            config.PROGRESS_MANAGER.set_uploading(self.uploaded_files)
372668
function () {
        this._files = {};
        this._global = new _File();
        Object.keys(this._data).forEach(function (fileName) {
            var fileCoverage = this._computeFileCoverage(fileName);
            this._files[fileCoverage.name] = fileCoverage;
            this._global.statements.add(fileCoverage.statements);
            this._global.functions.add(fileCoverage.functions);
            this._global.branches.add(fileCoverage.branches);
        }, this);
    }
735921
private void putFile(String name, UploadFile uploadFile) {
		UploadFile[] fileUploads = requestFiles.get(name);
		fileUploads = fileUploads == null ? new UploadFile[] { uploadFile } : ArrayUtil.append(fileUploads, uploadFile);
		requestFiles.put(name, fileUploads);
	}
265863
public void submit() {

        // create a JsArray containing the files to upload
        List<CmsFileInfo> filesToUpload = new ArrayList<CmsFileInfo>(getFilesToUpload().values());
        Collections.sort(filesToUpload, CmsFileInfo.INFO_COMPARATOR);

        CmsUploader uploader = new CmsUploader();
        uploader.uploadFiles(
            getUploadUri(),
            getTargetFolder(),
            m_isTargetRootPath,
            filesToUpload,
            getFilesToUnzip(false),
            this);
    }
629844
public function actionFileUpload() {

		$source = $this->config->getCompatibleSource($this->request->source);

		$root = $source->getRoot();
		$path = $source->getPath();

		$this->accessControl->checkPermission($this->getUserRole(), $this->action, $path);

		$messages = [];

		$files = $this->move($source);

		$isImages = [];
		$files = array_map(function (File $file) use ($source, $root, &$isImages) {
			$messages[] = 'File ' . $file->getName() . ' was uploaded';
			$isImages[] = $file->isImage();
			return str_replace($root, '', $file->getPath());
		}, $files);

		if (!count($files)) {
			throw new \Exception('No files have been uploaded', Consts::ERROR_CODE_NO_FILES_UPLOADED);
		}

		return [
			'baseurl' => $source->baseurl,
			'messages' => $messages,
			'files' => $files,
			'isImages' => $isImages
		];
	}
155666
protected function process()
    {

        // query whether or not we've the flag to upload the image files has been set
        if ($this->getSubject()->getConfiguration()->hasParam(ConfigurationKeys::COPY_IMAGES)) {
            // query whether or not we've to upload the image files
            if ($this->getSubject()->getConfiguration()->getParam(ConfigurationKeys::COPY_IMAGES)) {
                // initialize the array for the actual images
                $actualImageNames = array();

                // iterate over the available image fields
                foreach (array_keys($this->getImageTypes()) as $imageColumnName) {
                    // do nothing if the column is empty
                    if (!$this->hasValue($imageColumnName)) {
                        continue;
                    }

                    // override the image path with the new one, if the image has already been processed
                    if (isset($actualImageNames[$imageName = $this->getValue($imageColumnName)])) {
                        $this->setValue($imageColumnName, $actualImageNames[$imageName]);
                        continue;
                    }

                    // upload the file and set the new image path
                    $imagePath = $this->getSubject()->uploadFile($imageName);

                    // log a message that the image has been copied
                    $this->getSubject()
                         ->getSystemLogger()
                         ->debug(
                             sprintf(
                                 'Successfully copied image type %s with name %s => %s',
                                 $imageColumnName,
                                 $imageName,
                                 $imagePath
                             )
                         );

                    // override the image path with the new one
                    $this->setValue($imageColumnName, $imagePath);

                        // add the image to the list with processed images
                    $actualImageNames[$imageName] = $imagePath;
                }

                // query whether or not, we've additional images
                if ($additionalImages = $this->getValue(ColumnKeys::ADDITIONAL_IMAGES, null, array($this, 'explode'))) {
                    // process all the additional images
                    foreach ($additionalImages as $key => $additionalImageName) {
                        // query whether or not the image has already been processed
                        if (isset($actualImageNames[$additionalImageName])) {
                            // if yes, override the image path
                            $additionalImages[$key] = $imagePath;
                            // and override the image path with the new one
                            $this->setValue($imageColumnName, $actualImageNames[$additionalImageName]);
                            continue;
                        }

                        // upload the file and set the new image path
                        $imagePath = $this->getSubject()->uploadFile($additionalImageName);

                        // log a message that the image has been copied
                        $this->getSubject()
                             ->getSystemLogger()
                             ->debug(
                                 sprintf(
                                     'Successfully copied additional image wth name %s => %s',
                                     $additionalImageName,
                                     $imagePath
                                 )
                             );

                        // override the image path
                        $additionalImages[$key] = $imagePath;

                        // add the image to the list with processed images
                        $actualImageNames[$additionalImageName] = $imagePath;
                    }

                    // override the image paths with the new one
                    $this->setValue(ColumnKeys::ADDITIONAL_IMAGES, implode(',', $additionalImages));
                }
            }
        }
    }
923639
def upload_files(tree, file_diff):
    
    # Upload new files to CC
    config.LOGGER.info("\nUploading {0} new file(s) to Kolibri Studio...".format(len(file_diff)))
    tree.upload_files(file_diff)
    tree.reattempt_upload_fails()
    return file_diff
62181
def upload_file(client, bucket, local_path, remote_path, overwrite=False):
    """"""
    bucket = client.get_bucket(bucket)
    blob = storage.Blob(remote_path, bucket)
    if (not overwrite) and blob.exists():
        raise Conflict('File/object already exists on the bucket!')
    blob.upload_from_filename(local_path)
457696
def upload():
    

    def twine(*args):
        """ run a twine command """
        process = run(sys.executable, '-m', 'twine', *args)

        return process.wait() != 0

    if run(sys.executable, 'setup.py', 'sdist', 'bdist_wheel').wait() != 0:
        error('failed building packages')

    if twine('register', glob.glob('dist/*')[0]):
        error('register failed')

    if twine('upload', '-s', '-i', 'CB164668', '--skip-existing', 'dist/*'):
        error('upload failed')