If anyone is following here code that is working
class CrashUploader(webapp2.RequestHandler):
def post(self):
attachments = self.request.POST.get('crashrpt')
entity = DatastoreFile(data=attachments.value,
mimetype=attachments.type)
entity.appname =self.request.get('appname')
entity.appversion =self.request.get('appversion')
entity.emailfrom =self.request.get('emailfrom')
entity.crashguid =self.request.get('crashguid')
entity.md5 =self.request.get('md5')
entity.put()
file_url = "http://%s/%d/%s" % (self.request.host,
entity.key().id(), file.name)
self.response.out.write("Your uploaded file is now available at %s"
% (file_url,))
mail.send_mail(sender="YOUR_SITE",
to="THE ACCOUNT YOU WANT THEM TO GO TO",
subject="Crash Report",
body="""
Attached is the document file you requested. Is at %s
"""%file_url)
class CrashDownload(webapp.RequestHandler):
def get(self, id, filename):
entity = DatastoreFile.get_by_id(int(id))
self.response.headers['Content-Type'] = 'application/zip'
self.response.out.write(entity.data)
On Thursday, 30 July 2015 12:47:52 UTC-4, barryhunter wrote:
>
>
>
>> I don't really need it in the Google App engine, I just need to be stored
>> somewhere so even turning it into an email attachment and mailing it would
>> be fine.
>>
>> The code
>>
>> class CrashUploader(webapp2.RequestHandler):
>> def post(self):
>> file_data = self.request.get("crashrpt",default_value='This
>> Failed');
>>
>> grabs something. Does anyone know if I can use mail.send_mail to send it
>> out as an attachment.
>>
>
> Yes
> https://cloud.google.com/appengine/docs/python/mail/attachments
>
> So your dynamic handler could just accept the file, and immidiately send
> it out. Rather than storing it somewhere.
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-appengine/71e21541-c9aa-4d82-bbff-7621fc2c7c76%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.