Hi,
I'm developing an app and I have a little problem. I'm storing a PDF in the
datastore and then serving it. When I'm serving the file, the one I get is
corrupt. By I can't understand why.
I'm storing it like that:
class LogSenderHandler(InboundMailHandler):
def receive(self, mail_message):
for elemento in mail_message.attachments:
fax = FAX()
fax.immagine = db.Blob(str(elemento[1]))
fax.put()
And I'm serving it like that
class GetImage(webapp.RequestHandler):
def get(self):
immagine = db.Query(FAX).fetch(limit=1)
for elemento in immagine:
self.response.headers['Content-Type'] = 'application/pdf'
self.response.headers['Content-Disposition'] = 'attachment;
filename=fax.pdf'
self.response.out.write(elemento.immagine)
logging.error(elemento.immagine)
It think everything is okay.
--
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/-/DA3qvtvhJ5MJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.