Have you considered BlobstoreDownloadHandler? Using it is straighforward: class FileDownloadHandler(blobstore_handlers.BlobstoreDownloadHandler): def get(self, file_id): file_info = FileInfo.get_by_id(long(file_id)) if not file_info or not file_info.blob: self.error(404) return self.send_blob(file_info.blob, save_as=True)
I use a FileInfo class and I can recommend it. A good way to serve blobs I think is a FileInfo class for instance class FileInfo(db.Model): blob = blobstore.BlobReferenceProperty(required=True) uploaded_by = db.UserProperty(required=True) uploaded_at = db.DateTimeProperty(required=True, auto_now_add=True) Then you can conveniently serve it as if it were a static file ie. /file/1001 along the structure file/<file.id> : class FileInfoHandler(BaseHandler): def get(self, file_id): file_info = FileInfo.get_by_id(long(file_id)) if not file_info: self.error(404) return self.render_template("info.html", { 'file_info': file_info, 'logout_url': users.create_logout_url('/'), }) You may want to look at Nick Johnson's example for implementation with the blobstore http://blog.notdot.net/2010/03/Implementing-a-dropbox-service-with-the-Blobstore-API-Part-1 I think the example file serving app from Nick Johnson is good and if you use python and blobstore maybe you want to follow the link. My opinion is that serving and uploading files should be built into the framework but it is not. Instead we have to solve the same problem repeatedly: File uploads and file serving. Better to solve uploads and serving once and for all and the FileInfo class is so little boilerplate code I can add it to most of my apps since most of my apps need the functionality "add a file to the blobstore" and "serve a file from the blobstore" so if you ask me I say that these functions should be possible without writing your own app just as part of the app server. Regards, Niklas -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/PilliI2r9eoJ. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.