Django documentation

This document is for Django's SVN release, which can be significantly different from previous releases. Get old docs here: Django 1.0

File storage API


True if a file exists given some name.


The local filesystem path where the file can be opened using Python’s standard open(). For storage systems that aren’t accessible from the local filesystem, this will raise NotImplementedError instead.


Returns the total size, in bytes, of the file referenced by name.


Returns the URL where the contents of the file referenced by name can be accessed., mode='rb')

Opens the file given by name. Note that although the returned file is guaranteed to be a File object, it might actually be some subclass. In the case of remote file storage this means that reading/writing could be quite slow, so be warned., content)

Saves a new file using the storage system, preferably with the name specified. If there already exists a file with this name name, the storage system may modify the filename as necessary to get a unique name. The actual name of the stored file will be returned.

The content argument must be an instance of django.core.files.File or of a subclass of File.


Deletes the file referenced by name. This method won’t raise an exception if the file doesn’t exist.


Having trouble? We'd like to help!