Return a file stream instance of the upload.
973836
def get_file_stream(self):
        
        if self.file_stream:
            self.file_stream.seek(0)
            return self.file_stream
        elif os.path.isfile(self.file_path):
            return open(self.file_path, 'rb')
        else:
            raise ValueError("invalid file {}".format(self.file_path))
1019432
def from_stream(cls, f, **kwargs):
        """"""
        lines = lines_from_stream(f)
        if 'meta' not in kwargs:
            kwargs['meta'] = {'from': 'stream'}
        kwargs['meta']['filepath'] = f.name if hasattr(f, 'name') else None
        return cls(lines, **kwargs)
1230321
def get_upload_form(self):
        """"""
        return self.form_class(self.request.POST, self.request.FILES)
847165
function _bn_getFile(input) {
    // if there is custom file upload logic, for example, images are resized client-side
    // generated Blobs should be assigned to fileInput._file
    // and can be sent via ajax with FormData

    // if file was deleted, custom field can be set to an empty string

    // Bunny Validation detects if there is custom Blob assigned to file input
    // and uses this file for validation instead of original read-only input.files[]
    if (input._file !== undefined && input._file !== '') {
        if (input._file instanceof Blob === false) {
            console.error("Custom file for input " + input.name + " is not an instance of Blob");
            return false;
        }
        return input._file;
    }
    return input.files[0] || false;
}
241315
def get_files():
    """"""

    files = dict()

    for k, v in request.files.items():
        content_type = request.files[k].content_type or 'application/octet-stream'
        val = json_safe(v.read(), content_type)
        if files.get(k):
            if not isinstance(files[k], list):
                files[k] = [files[k]]
            files[k].append(val)
        else:
            files[k] = val

    return files
307939
def _from_stream(cls, stream, blob, filename=None):
        
        image_header = _ImageHeaderFactory(stream)
        if filename is None:
            filename = 'image.%s' % image_header.default_ext
        return cls(blob, filename, image_header)
733170
def get_stream(self, rel_path, cb=None, return_meta=False):
        """"""
        from boto.s3.key import Key
        from boto.exception import S3ResponseError

        import StringIO
        from . import MetadataFlo

        b = StringIO.StringIO()
        try:
            k = self._get_boto_key(rel_path)
            if not k:
                return None

            k.get_contents_to_file(b, cb=cb, num_cb=100)

            b.seek(0)

            if return_meta:
                d = k.metadata
                d['size'] = k.size
                d['etag'] = k.etag
            else:
                d = {}

            return MetadataFlo(b, d)

        except S3ResponseError as e:
            if e.status == 404:
                return None
            else:
                raise e
223166
def fetch_to_file(self, filename):
        """"""
        self.filename = filename
        stream = self.client.get_iter_content(self.uri)
        content_type = self.client.response_headers['content-type']

        if content_type in _content_type_map:
            self.fileext = _content_type_map[content_type]
            self.filename = "%s.%s" % (self.filename, self.fileext)

        with open(self.filename, 'wb') as file_handle:
            for chunk in stream:
                file_handle.write(chunk)
475250
def get_upload_path(instance, filename):
    """"""
    if not instance.name:
        instance.name = filename  # set original filename
    date = timezone.now().date()
    filename = '{name}.{ext}'.format(name=uuid4().hex,
                                     ext=filename.split('.')[-1])

    return os.path.join('post_office_attachments', str(date.year),
                        str(date.month), str(date.day), filename)
608782
function getStream()
    {
        if ($err = $this->getError() !== UPLOAD_ERR_OK)
            // TODO Handle Upload With Exception Error
            throw new \RuntimeException(sprintf(
                'Cannot retrieve stream due to upload error. error: (%s).'
                , getUploadErrorMessageFromCode($err)
            ));

        if ($this->isFileMoved)
            throw new \RuntimeException('Cannot retrieve stream after it has already been moved');

        if ($this->stream)
            return $this->stream;

        $givenFileResource = $this->_c_givenResource;
        if (!$givenFileResource instanceof StreamInterface)
            $givenFileResource = new Stream($givenFileResource, 'r');
        
        return $this->stream = $givenFileResource;
    }
1332165
def load(self):
        
        stream = self.fs.load()
        stream = self.codec.decompress(stream)
        return stream
106625
def get_stream(path, response_block, params = nil, headers = {}, auth = true)
      request(path: path, query: params, headers: headers, response_block: response_block, auth: auth, gzip: false)
    end
508183
def FromFile(cls, filename, overwrite=False, auto_transfer=True, **kwds):
        """"""
        path = os.path.expanduser(filename)
        if os.path.exists(path) and not overwrite:
            raise exceptions.InvalidUserInputError(
                'File %s exists and overwrite not specified' % path)
        return cls(open(path, 'wb'), close_stream=True,
                   auto_transfer=auto_transfer, **kwds)
836036
def upload_path(instance, filename):
    '''
        
    '''

    filename = filename.replace(" ", "_")
    filename = unicodedata.normalize('NFKD', filename).lower()
    return os.path.join(str(timezone.now().date().isoformat()), filename)
1125121
def upload(self, file_obj):
        
        return self._client.upload_object(
            self._instance, self._bucket, self.name, file_obj)
312976
def default_stream_factory(
    total_content_length, filename, content_type, content_length=None
):
    """"""
    max_size = 1024 * 500
    if SpooledTemporaryFile is not None:
        return SpooledTemporaryFile(max_size=max_size, mode="wb+")
    if total_content_length is None or total_content_length > max_size:
        return TemporaryFile("wb+")
    return BytesIO()
1016279
function(err, str, fileDetails) {
      if (err) {
        return cb(err);
      }

      var res = {
        stream: str,
        type: fileDetails.contentType,
        length: fileDetails.length,
        name: fileDetails.filename
      };
      return cb(undefined, res);
    }