0

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

I am using Python on Google App Engine

Input page Javascript

var imgData = $('#chart1').jqplotToImageStr({});
$('<tr style="display:none"><td><input type="hidden" name="extract1"></td></tr>')
    .appendTo('.getpdf')
    .find('input')
    .data(imgData);

Output page:

def post(self):
    form = cgi.FieldStorage()   
    extract1 = form.getvalue('extract1') #extract1 is empty

I tried to print the form and it looked as:MiniFieldStorage('extract1', '"data:image/png;base64,iVBORw0KGgoAAAANSUhE

If I assigned the data-url (data:image/png;base64,iVBORw0KGg...), it worked.

4

1 に答える 1

1

I have (working) code that does something similar.

def post(self):
  img_data = self.request.get('extract1')
  # then strip off the prefix and convert from base64

is what I'm doing. Poking into cgi.FieldStorage isn't something I normally see done in Python App Engine apps.

于 2013-03-28T04:00:39.407 に答える