1234567891011 |
- def write_file(file_data, destination):
- """Write Django uploaded file object to disk incrementally in order to
- avoid sucking up all of the system's RAM by reading the whole thing in to
- memory at once.
- """
- out = open(destination, "wb+")
- for chunk in file_data.chunks():
- out.write(chunk)
- out.close()
|