werkzeug.FileStorage.save

FileStorage.save(dst, buffer_size=16384)[source]

Save the file to a destination path or file object. If the destination is a file object you have to close it yourself after the call. The buffer size is the number of bytes held in memory during the copy process. It defaults to 16KB.

For secure file saving also have a look at secure_filename().

Parameters:
  • dst – a filename or open file object the uploaded file is saved to.
  • buffer_size – the size of the buffer. This works the same as the length parameter of shutil.copyfileobj().