Friday 15 February 2013

python - Google App Engine Upload to TextArea (without the blobstore) -


I am trying to read simple file in GAE Python. I want to allow users to upload CSV files directly from their disk and display it in a text field. I am being an abusive part of the problem in doing this. Any assistance will be appreciated. If possible, I prefer to avoid using a Bluetooth booster. I do not want to save data forever, I want to use it so that people can easily fill the texts.

How does my form look here

  & lt; Div class = "section hidden" id = "file_choice" & gt; & Lt; Form Action = "Post" Encrypt = "Multipart / Form-Data" & gt; Choose a '.CSV' file that you want to upload or convert. & Lt; Br> & Lt; Input type = "file" id = "filein" name = "filecsv" /> & Lt; Br> & Lt; I & gt; If you are unsure how to change your file to CSV click & lt; A hred = "/ instructions" & gt; Here & lt; / A & gt; & Lt; / I & gt; & Lt; Br> & Lt; Input type = "submit" name = "submit_final" /> & Lt; Br> Alternatively, you can use this text box to copy paste from any editor. & Lt; Textarea name = "txtcsv" cols = "150" rows = "30" & gt; {{MyFile}} & lt; / Textarea & gt; & Lt; / Form & gt; & Lt; / Div & gt;   

This is how my code looks,

  class handler (webapp2.RequestHandler): # wraps response.out.write For self, * a, ** kw): self.response.out.write (* a, ** kw) # renders a template as string deff render_str (self, template, ** parameter): t = Jinja_env.get_template (template) Returns T. Render (Param) renders the template on the screen using the #def render (self, template, ** kw): self. Written (auto .rdar_strip (template, ** kw)) Mainhandler: Def found (Self): self Render ('parseForm.html') def post (auto): test = self.request.POST ['filescsv']. Getvalue () self.render ('parseForm.html', myFile = test, error = "ERRORRRR")   

Now the texture file is output as the file name. Documents on File Upload for GAC are very vague, the only line in the webapp 2 dock:

Uploaded files are available in the form of CGA .Findstorridge (see CGI module) directly in the request. POST.

I am going to follow this post with your question on the topic, but if you use it:

  test = self.request .POST ['filescsv']. Instead of Value  < getvalue ()  (which gives an error to me), you will see the render output of your CSV file.   

No comments:

Post a Comment