Used as the ``upload_to`` arg for file fields - allows for custom
    handlers to be implemented on a per field basis defined by the
    ``UPLOAD_TO_HANDLERS`` setting.
772994
def upload_to(field_path, default):
    
    from yacms.conf import settings
    for k, v in settings.UPLOAD_TO_HANDLERS.items():
        if k.lower() == field_path.lower():
            return import_dotted_path(v)
    return default
1045362
def set_file_to_upload(self, file_to_upload):
        # type: (str) -> None
        
        if 'url' in self.data:
            del self.data['url']
        self.file_to_upload = file_to_upload
477285
protected function autoUpload()
    {
        foreach ($this->getDefinedUploadFields() as $key => $val) {
            $field = is_int($key) ? $val : $key;
            $options = array_wrap($val);

            // check if global upload is allowed, then in override in option
            $autoUploadAllowed = array_get($options, 'auto_upload', $this->canAutoUploadImages());

            if (!$autoUploadAllowed) {
                continue;
            }

            // get the input file name
            $requestFileName = array_get($options, 'file_input', $field);

            // if request has the file upload it
            if (request()->hasFile($requestFileName)) {
                $this->uploadImage(
                    request()->file($requestFileName),
                    $field
                );
            }
        }
    }
223939
def to_fileupload
      {
        id: id,
        name: filename,
        content_type: content_type,
        size: size,
        url: url,
        thumb_url: thumb_url
      }
    end
76284
def build_upload_params(file_path, outputformat, callback_url = nil, options = {})
      upload_params = { :format => outputformat}
      upload_params.merge!(:callback => callback(callback_url)) if callback(callback_url).present?
      upload_params.merge!(:input => "download",:link => file_path )
      upload_params.merge!(options)
    end
201995
function uploadFiles(files) {
    var index = 0,
        file = files[index];

    /**
    * Recursive helper used as callback for server.raw(put)
    * @param {error} err - Error message if something went wrong
    */
    var processFile = function processFile (err) {
      if (err) {
        grunt.log.warn(messages.fileTransferFail(file.dest, err));
      } else {
        grunt.log.ok(messages.fileTransferSuccess(file.dest));
      }

      ++index;
      // If there are more files, then keep pushing
      if (index < files.length) {
        file = files[index];
        server.put(grunt.file.read(file.src, { encoding: null }), file.dest, processFile);
      } else {
        // Close the connection, we are complete
        server.raw('quit', function(quitErr) {
          if (quitErr) {
            grunt.log.error(quitErr);
            done(false);
          }
          server.destroy();
          grunt.log.ok(messages.connectionClosed);
          done();
        });
      }
    };

    // Start uploading files
    server.put(grunt.file.read(file.src, { encoding: null }), file.dest, processFile);
  }
900260
def Upload(cls, filename):
        
        raise Exception("to do")
    
        TOOLS_PATH = ""
        RESOURCE_PATH = ""
        tool_4path = os.path.join(TOOLS_PATH, "upload.exe")        
        file_4path = os.path.join(RESOURCE_PATH, filename)
        #file_4path.decode('utf-8').encode('gbk')
        
        if os.path.isfile(file_4path):
            cls.Click()
            os.system(tool_4path + ' ' + file_4path)
        else:
            raise Exception('%s is not exists' % file_4path)
958211
def custom_field_rendering(context, field, *args, **kwargs):
    
    if CUSTOM_FIELD_RENDERER:
        mod, cls = CUSTOM_FIELD_RENDERER.rsplit(".", 1)
        field_renderer = getattr(import_module(mod), cls)
        if field_renderer:
            return field_renderer(field, **kwargs).render()
    return field
1063645
def upload_simple(self, fd, filename, folder_key=None, path=None,
                      filedrop_key=None, action_on_duplicate=None,
                      mtime=None, file_size=None, file_hash=None):
        
        action = 'upload/simple'

        params = QueryParams({
            'folder_key': folder_key,
            'path': path,
            'filedrop_key': filedrop_key,
            'action_on_duplicate': action_on_duplicate,
            'mtime': mtime
        })

        headers = QueryParams({
            'X-Filesize': str(file_size),
            'X-Filehash': file_hash,
            'X-Filename': filename.encode('utf-8')
        })

        upload_info = {
            "fd": fd,
        }

        return self.request(action, params, action_token_type="upload",
                            upload_info=upload_info, headers=headers)
220939
def upload_file(self, file_name, file_obj, *args, **kwargs):
		
		self.dav_client().upload_to(file_obj, self.join_path(self.session_path(), file_name))
154540
def _fix_up_fields(cls):
        """"""
        cls._arguments = dict()
        if cls.__module__ == __name__: # skip the classes in this file
            return
        for name in set(dir(cls)):
            attr = getattr(cls, name, None)
            if isinstance(attr, BaseArgument):
                if name.startswith('_'):
                    raise TypeError("Endpoint argument %s cannot begin with "
                            "an underscore, as these attributes are reserved "
                            "for instance variables of the endpoint object, "
                            "rather than for arguments to your HTTP Endpoint."
                            % name)
                attr._fix_up(cls, name)
                cls._arguments[attr.name] = attr
180302
function onFile(__newFile, encoding, done) {
  var buffers = [];
  var options = this.options;

  // Check the file limit
  if (options.perMaxBytes && __newFile.byteCount > options.perMaxBytes) {
    return done(new Error('The file \'' + __newFile.filename + '\' beyond size limit, only accept less than ' + options.perMaxBytes + ' bytes'));
  }

  // Check the accept content type
  if (options.acceptTypes && options.acceptTypes.indexOf(__newFile.headers['content-type']) === -1) {
    return done(new Error('Content-type of the file \'' + __newFile.filename + '\' does not accepted'));
  }

  // Determine the file descriptor-- the unique identifier.
  // Often represents the location where file should be written.
  __newFile.fd;
  var uploadDir = __newFile.fd;
  if (uploadDir.substr(0, 1) !== '/') {
    uploadDir = '/' + uploadDir;
  }

  // When then 'data' event emited, push the chunk to the buffers array.
  __newFile.on('data', function (chunk) {
    buffers.push(chunk);
  });

  // When the 'end' event emited, upload the 'buffers' to the upyun server.
  __newFile.on('end', function () {
    var buffer = Buffer.concat(buffers);
    uploadToUpyun.bind({ options })(uploadDir, buffer, __newFile, done);
  });
}
611015
def uploads(self, option):
    
    params = join_params(self.parameters, {"uploads": option})

    return self.__class__(**params)
197316
def upload_file_handle(
            self,
            bucket: str,
            key: str,
            src_file_handle: typing.BinaryIO,
            content_type: str=None,
            metadata: dict=None):
        
        raise NotImplementedError()
1301762
def file_upload(f):
    

    @wraps(f)
    def file_upload_decorator(*args, **kwargs):
        # If the data is already transformed, we do not transform it any
        # further.
        task_data = _get_data_from_args(args)

        if task_data is None:
            logging.error("Task data is empty during FilesUploadDecorator.")

        task_data.transform_payload(lambda _: request.files.getlist('file'))
        return f(*args, **kwargs)

    return file_upload_decorator
1004574
def _process_file(self, obj, fobj, field):
        
        from uliweb import settings
        
        paths = []
        upload_to = self.upload_to or self._get_upload_path(field, 'upload_to', obj)
        if upload_to:
            self.fileserving.to_path = upload_to
        upload_to_sub = self.upload_to_sub or self._get_upload_path(field, 'upload_to_sub', obj)
        if upload_to_sub:
            paths.append(upload_to_sub)
        paths.append(fobj['filename'])
        
        return self.fileserving.save_file(os.path.join(*paths), 
            fobj['file'], replace=self.file_replace, 
            convert=self.file_convert)
723947
def upload_create(self, data, filename=None, token=None, **kwargs):
        ""
        api_path = "/api/v2/uploads.json"
        api_query = {}
        if "query" in kwargs.keys():
            api_query.update(kwargs["query"])
            del kwargs["query"]
        if filename:
            api_query.update({
                "filename": filename,
            })
        if token:
            api_query.update({
                "token": token,
            })
        return self.call(api_path, query=api_query, method="POST", data=data, **kwargs)