Friday 15 January 2010

python - cgi get submitted image data-url -


Sorry if this question is dumb. I changed a jqplot image to a data-url and sent it with a form. In the new page, I used the cgi.FieldStorage () to get the data-url submitted but nothing was found. So can someone give me some suggestions on my approach? Thanks!

I am using Python on Google App Engine

Input Page JavaScript

  var imgData = $ ('# chart1'). JqplotToImageStr ({}); $ ('& Lt; tr style = "display: none"> gt; & lt; td & gt; & lt; input type = "hidden" name = "extract1" & gt; & lt; / td & gt; ; & Lt; / tr & gt; ') .appendTo (' .getpdf ') .Fund (' Input '). Data (IMGData);   

Output page:

  def post (self): form = cgi.FieldStorage () extract1 = form.getvalue ('extract1') is # extract1 I tried to print the form and saw it as:  MiniFieldStorage ('extract1', '' data: image / png; base64, iVBORw0KGgoAAAANSUhE   

If I have assigned the data-url (Data: Image / PGG; Base64, IVBORKKKG ...), then it has worked.

I have a working code that does something similar.

  def post (Self): img_data = self.request.get ('extract1') # Close the bar prefix and change it from base 64   

What I am doing. cgi Opening in .FieldStorage is not something I usually did in the Python App Engine App.

No comments:

Post a Comment