@!group App Icons

 Uploads a large icon
 @param app_version (AppVersion): The version of your app
 @param upload_image (UploadFile): The icon to upload
 @return [JSON] the response
186987
def upload_large_icon(app_version, upload_image)
      raise "app_version is required" unless app_version
      raise "upload_image is required" unless upload_image

      du_client.upload_large_icon(app_version, upload_image, content_provider_id, sso_token_for_image)
    end
497924
def upload(self, force=False):
        
        self.package and self.release
        try:
            return self.aserver_api.upload(self.username, self.project, self.version,
                                       basename(self.filepath), open(self.filepath, 'rb'),
                                       self.filepath.split('.')[-1])
        except errors.Conflict:
            if force:
                self.remove()
                return self.upload()
            else:
                msg = "Conflict: {} already exist in {}/{}".format(self.filepath,
                                                                   self.project,
                                                                   self.version)
                raise errors.BinstarError(msg)
688503
def changeGroupImageRemote(self, image_url, thread_id=None):
        
        (image_id, mimetype), = self._upload(get_files_from_urls([image_url]))
        return self._changeGroupImage(image_id, thread_id)
848876
def upload_binary
      if options[:ipa]
        uploader = AppRepo::Uploader.new(options)
        result = uploader.upload
        msg = 'Binary upload failed. Check out the error above.'
        UI.user_error!(msg) unless result
      end
    end
870951
def _upload_resumable_unit(self, uu_info):
        

        # Get actual unit size
        unit_size = uu_info.fd.len

        if uu_info.hash_ is None:
            raise ValueError('UploadUnitInfo.hash_ is now required')

        return self._api.upload_resumable(
            uu_info.fd,
            uu_info.upload_info.size,
            uu_info.upload_info.hash_info.file,
            uu_info.hash_,
            uu_info.uid,
            unit_size,
            filedrop_key=uu_info.upload_info.filedrop_key,
            folder_key=uu_info.upload_info.folder_key,
            path=uu_info.upload_info.path,
            action_on_duplicate=uu_info.upload_info.action_on_duplicate)
1291849
def version_add(package, version, pkghash, force=False):
    
    team, owner, pkg = parse_package(package)
    session = _get_session(team)

    try:
        Version(version)
    except ValueError:
        url = "https://www.python.org/dev/peps/pep-0440/#examples-of-compliant-version-schemes"
        raise CommandException(
            "Invalid version format; see %s" % url
        )

    if not force:
        answer = input("Versions cannot be modified or deleted; are you sure? (y/n) ")
        if answer.lower() != 'y':
            return

    session.put(
        "{url}/api/version/{owner}/{pkg}/{version}".format(
            url=get_registry_url(team),
            owner=owner,
            pkg=pkg,
            version=version
        ),
        data=json.dumps(dict(
            hash=_match_hash(package, pkghash)
        ))
    )
1371836
def appliance_api_version
      options = { 'Content-Type' => :none, 'X-API-Version' => :none, 'auth' => :none }
      response = rest_api(:get, '/rest/version', options)
      version = response_handler(response)['currentVersion']
      raise ConnectionError, "Couldn't get API version" unless version
      version = version.to_i if version.class != Integer
      version
    rescue ConnectionError
      @logger.warn "Failed to get OneView max api version. Using default (#{OneviewSDK::DEFAULT_API_VERSION})"
      OneviewSDK::DEFAULT_API_VERSION
    end
567718
def upload_kitten(client):
	'''
		
	'''

	# Here's the metadata for the upload. All of these are optional, including
	# this config dict itself.
	config = {
		'album': album,
		'name':  'Catastrophe!',
		'title': 'Catastrophe!',
		'description': 'Cute kitten being cute on {0}'.format(datetime.now())
	}

	print("Uploading image... ")
	image = client.upload_from_path(image_path, config=config, anon=False)
	print("Done")
	print()

	return image
887189
def set_img_path(instance, filename):
    
    upload_path = '/'.join(
        ['img', instance._meta.app_label, str(now.year), str(now.month), filename]
    )
    return upload_path
866287
def add_version(self, project, version, egg):
        
        url = self._build_url(constants.ADD_VERSION_ENDPOINT)
        data = {
            'project': project,
            'version': version
        }
        files = {
            'egg': egg
        }
        json = self.client.post(url, data=data, files=files,
                                timeout=self.timeout)
        return json['spiders']
778145
def icon=(icon)
      if icon.respond_to? :read
        icon_string = 'data:image/jpg;base64,'
        icon_string += Base64.strict_encode64(icon.read)
        update_server_data(icon_id: icon_string)
      else
        update_server_data(icon_id: icon)
      end
    end
1291915
def to_jq_upload
      {
        "name" => read_attribute(:asset_name),
        "size" => asset_size,
        "url" => asset_url,
        "thumbnail_url" => asset.thumb('80x80#').url,
        "delete_url" => Wafflemix::Engine::routes.url_helpers.admin_asset_path(:id => id),
        "delete_type" => "DELETE"
      }
    end
22367
protected function uploadToGithub($version, $githubToken, $upload_url)
	{
		$deploy  = explode(' ', $this->getJConfig()->target);
		$zipfile = $this->getExtensionName() . '-' . $this->getJConfig()->version . '.zip';

		if (in_array('package', $deploy))
		{
			$zipfile = 'pkg-' . $zipfile;
		}

		$zipfilepath = JPATH_BASE . '/dist/' . $zipfile;

		$filesize = filesize($zipfilepath);

		$this->say('Uploading the Extension package to the Github release: ' . $version);

		$uploadUrl = str_replace("{?name,label}", "?access_token=" . $githubToken . "&name=" . $zipfile . "&size=" . $filesize, $upload_url);
		$request   = curl_init($uploadUrl);

		curl_setopt($request, CURLOPT_POST, true);
		curl_setopt($request, CURLOPT_VERBOSE, true);

		curl_setopt($request, CURLOPT_HTTPHEADER, array(
			'Authorization: token ' . $githubToken,
		));

		curl_setopt($request, CURLOPT_HTTPHEADER, array('Content-type: application/zip'));
		curl_setopt($request, CURLOPT_POSTFIELDS, file_get_contents($zipfilepath));
		curl_setopt($request, CURLOPT_SSL_VERIFYHOST, 0);
		curl_setopt($request, CURLOPT_SSL_VERIFYPEER, 0);

		$result = curl_exec($request);

		curl_close($request);

		$this->say(print_r($result, true));
	}
1032470
def upload_file(f)
      # grabs the compiled asset from public_path
      full_file_path = File.join(File.dirname(@manifest.dir), f)
      one_year = 31557600
      mime = Rack::Mime.mime_type(File.extname(f)) 
      file = {
        :key => f,
        :public => true,
        :content_type => mime,
        :cache_control => "public, max-age=#{one_year}",
        :expires => CGI.rfc1123_date(Time.now + one_year) 
      }

      gzipped = "#{full_file_path}.gz" 

      if File.exists?(gzipped)
        original_size = File.size(full_file_path)
        gzipped_size = File.size(gzipped)

        if gzipped_size < original_size
          file.merge!({
            :body => File.open(gzipped),
            :content_encoding => 'gzip'
          })
          log "Uploading #{gzipped} in place of #{f}"
        else
          file.merge!({
            :body => File.open(full_file_path)
          })
          log "Gzip exists but has larger file size, uploading #{f}"
        end
      else
        file.merge!({
          :body => File.open(full_file_path)
        })
        log "Uploading #{f}"
      end
      # put in reduced redundancy option here later if desired

      file =  bucket.files.create( file )
    end
168694
def url(name = nil)
      if name
        if version_identifiers.include?(name.to_s)
          self[:@versions][name.to_s][:@url]
        else
          raise "Invalid Image Version identifier: '#{name}' (must be #{version_identifiers.join(', ')})"
        end
      else
        self[:@url]
      end
    end
1322393
function (res, name, version) {
  //Options
  var imgPath, width;
  //RegExp
  var re = /^\d\.\d.\d$/;
  //Test version
  if (re.test(version)) {
    imgPath = path.join(dir, name + '.png');
    width = 76;
  } else if (version.length === 6) {
    imgPath = path.join(dir, name + '-larger.png');
    width = 80;
  } else if (version.length === 7) {
    imgPath = path.join(dir, name + '-larger.png');
    width = 77;
  } else {
    imgPath = path.join(dir, name + '-larger.png');
    width = 74;
  }

  //Create Image
  var base = gm(imgPath)
    .font(path.join(__dirname, 'fonts', 'Arial.ttf'))
    .fontSize(10)
    .fill('#ffffff')
    .drawText(width, 12, version);
  //Write Stream and send to client
  write(base, res);
}
1316013
public boolean canUploadVersion(String name, long fileSize) {

        URL url = CONTENT_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID());
        BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, "OPTIONS");

        JsonObject preflightInfo = new JsonObject();
        if (name != null) {
            preflightInfo.add("name", name);
        }

        preflightInfo.add("size", fileSize);

        request.setBody(preflightInfo.toString());
        try {
            BoxAPIResponse response = request.send();

            return response.getResponseCode() == 200;
        } catch (BoxAPIException ex) {

            if (ex.getResponseCode() >= 400 && ex.getResponseCode() < 500) {
                // This looks like an error response, menaing the upload would fail
                return false;
            } else {
                // This looks like a network error or server error, rethrow exception
                throw ex;
            }
        }
    }