def save(self, filesto, upload_to=None, name=None, secret=None, prefix=None,<EOL>allowed=None, denied=None, max_size=None, **kwargs):
if not filesto:<EOL><INDENT>return None<EOL><DEDENT>upload_to = upload_to or self.upload_to<EOL>secret = secret or self.secret<EOL>prefix = prefix or self.prefix<EOL>original_filename = filesto.filename<EOL>allowed = allowed or self.allowed<EOL>denied = denied or self.denied<EOL>self.validate(filesto, allowed, denied, max_size)<EOL>if callable(upload_to):<EOL><INDENT>filepath = upload_to(original_filename)<EOL><DEDENT>else:<EOL><INDENT>filepath = upload_to<EOL><DEDENT>oname, ext = os.path.splitext(original_filename)<EOL>if name:<EOL><INDENT>new_name = name(original_filename) if callable(name) else name<EOL><DEDENT>else:<EOL><INDENT>new_name = get_random_filename() if secret else prefix + oname<EOL><DEDENT>filename = get_unique_filename(self.base_path, filepath, new_name, ext=ext)<EOL>fullpath = os.path.join(<EOL>make_dirs(self.base_path, filepath),<EOL>filename<EOL>)<EOL>filesto.save(fullpath)<EOL>filesize = os.path.getsize(fullpath)<EOL>if max_size and filesize > max_size:<EOL><INDENT>self.delete_file(fullpath)<EOL>raise RequestEntityTooLarge<EOL><DEDENT>return os.path.join(filepath, filename)<EOL>
Except for `filesto`, all of these parameters are optional, so only
bother setting the ones relevant to *this upload*.

filesto
:   A `werkzeug.FileUploader`.

upload_to
:   Relative path to where to upload

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

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

name
:   If set, it'll be used as the name of the uploaded file.
    Instead of a string, this can also be a callable.

allowed
:   List of allowed file extensions. `None` 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 attribute `max_content_length` defined in the
    `request` object has higher priority.