FileInfo is provided by the
If you use the Blobstore API to upload files to Google Cloud Storage,
handler receives the resulting metadata such as the filename, creation date,
and content type, and the complete Google Cloud Storage object name including path. Your upload
handler extracts this metadata into
FileInfo objects using the
FileInfo metadata is not persisted to datastore.
(There is no blob key either, but you can create one later if needed by calling
create_gs_key.) You must save the
yourself in your upload handler or this data will be lost. The other metadata
for the object in Google Cloud Storage is stored in Google Cloud Storage automatically, so you don't need to
save that in your upload handler.
When a blob is uploaded to
Google Cloud Storage using
the Blobstore API, certain metadata is created, such as the filename,
creation time, file size, content type, and most importantly, the full Google Cloud Storage
filename that you need to retrieve the file from Google Cloud Storage. Blobstore passes
this metadata to the upload handler in the headers of the MIME part for the
file. The upload handler can parse this information into a FileInfo object
without calling the datastore using the
function. If you're using the webapp or webapp2 application framework, you can
for more convenient parsing of this information.
FileInfo instance has the following properties:
- The MIME type of the Blobstore object, as provided by the client in the
Content-TypeHTTP header during upload. A string.
- The date and time the blob was saved to Google Cloud Storage. A
- The filename of blob written to Google Cloud Storage, as provided by the client that
uploaded the file. A
- The size of the file.
- The md5 hash value of the blob uploaded to Google Cloud Storage.
- The full name of the file written to Google Cloud Storage (including path) or None if the file was not uploaded to Google Cloud Storage.