google app engine - GAE (Python) form file upload + email file as attachment -
i need implement rather simple web form on google app engine (gae-python) accepts form input (name, email, telephone) , resume (typically txt, pdf or doc/docx) file. once form submitted, want contents of form emailed , if file submitted in form, included attachment in same email designated email address.
- i don't need file exist after emailed/attached. sort of temp file, or stored in temp blob store.
- with html5 , jquery, there lot of fancy user interfaces implement file uploads. there recommended approach use 1 of these work nicely gae, being able degrade gracefully if browser not support modern methods (namely ie)?
i using jinja2 framework, if relevant. (i python novice way)
thanks in advance!
for upload file blob in gae need blobstore_handlers
built-in framework called webapp
. docs have complete sample upload files , not think there other ways upload blobstore.
when have blob see first sample of page docs attach blob email.
now, "temp file solution" can try different way: write upload file ram stringio python module. that:
<form action="/test/" method="post" enctype="multipart/form-data"> <input type="file" name="file"><br> <input type="submit"name="submit" value="submit"> </form>
def post(self): output = stringio.stringio() upload = self.request.get('file') output.write(upload) self.response.write(output.getvalue())
Comments
Post a Comment