Should be able to overwrite files (ie disable resolve_conflict)

Issue #6 new
Sundar Raman
created an issue

There are many instances when the uploaded file should overwrite the existing file, rather than creating a new file name. I would like to suggest an option to the uploads_set, to define whether to overwrite existing files or not, and have resolve_conflicts() check to see if this flag is set or not before creating new files. If overwrite is allowed, it would just return the existing filename.

Comments (2)

  1. Jeremy Epstein

    I got around this by manually checking if the uploaded file already exists on the filesystem, and deleting it if so. I.e. something like this:

    import os
    from werkzeug import secure_filename
    filename = secure_filename(
    filepath = os.path.join(
    if os.path.exists(filepath):
        os.remove(filepath), name=filename)

    This does the trick - but I agree, would be nicer if Flask-Uploads simply had an option to "resolve by overwriting" rather than to just "resolve by changing filename".

  2. Log in to comment