def __init__(self, base_path, upload_to='<STR_LIT>', secret=False,<EOL>prefix='<STR_LIT>', allowed=None, denied=None, max_size=None):
self.base_path = base_path.rstrip('<STR_LIT:/>')<EOL>try:<EOL><INDENT>os.makedirs(os.path.realpath(base_path))<EOL><DEDENT>except (OSError) as e:<EOL><INDENT>if e.errno != errno.EEXIST:<EOL><INDENT>raise<EOL><DEDENT><DEDENT>self.upload_to = upload_to<EOL>self.secret = secret<EOL>self.prefix = prefix<EOL>self.allowed = allowed or IMAGES<EOL>self.denied = denied or []<EOL>self.max_size = max_size<EOL>
Except for `base_path`, all of these parameters are optional,
so only bother setting the ones relevant to your application.

base_path
:   Absolute path where the files will be stored. Example:
    `/var/www/example.com/media`.

    MEDIA_DIR = realpath(join(BASE_DIR, 'media'))

base_url
:   The base path used when building the file's URL. By default
    is `/static/media`.

    UPLOADS_URL = '/media'

upload_to
:   Relative path.
    Instead of a string, this can also be a callable.

secret
:   If True, instead of the original filename, a random one'll
     be used.

prefix
:   To avoid race-co[nditions between users uploading files with
    the same name at the same time. If `secret` is True, this
    will be ignored.

allowed
:   List of allowed fi]le extensions. `True` to allow all
    of them. If the uploaded file doesn't have one of these
    extensions, an `UnsupportedMediaType` exception will be
    raised.

denied
:   List of forbidden extensions. Set to `None` to disable.
    If the uploaded file *does* have one of these extensions, a
    `UnsupportedMediaType` exception will be raised.

max_size
:   Maximum file size, in bytes, that file can have.
    Note: The `request` attribute `max_content_length`, if defined,
    has higher priority.