Exemple #1
0
    def post(self):
        upload_files = self.get_uploads('file')
        blob_key = upload_files[0].key()
        name = self.request.get('name')
        user = users.get_current_user()
        username = user.nickname()
        date = datetime.datetime.now()
        str_blob_key = str(blob_key)

        key = FileMetadata.getKeyName(username, date, str_blob_key)
        m = FileMetadata(key_name=key)
        m.filename = name
        m.uploadedOn = date
        m.owner = user
        m.blobkey = str_blob_key
        m.put()

        self.redirect('/')