I'm not sure there's quite enough to go on here, but I'll take a whack. A couple questions up front in case I my intuition is incorrect.
What data is passed in request.form['data']?
(FYI, you should avoid using 'file' as a variable name in Python as it's a builtin in and may cause some undesired behaviors)
Is an attachment being added to the document at all? (you can look in futon at your doc and see it there's an attachment and if so, of what size)
- If the attachment is being saved, how are you trying to display it afterwards that results in a blank square?
I'll assume you're posting the image data, but aren't able to save it as an attachment. From the docs for the Python couchdb module,
put_attachment(doc, content, filename, content_type)
expects particular types ofcontent:
content – the content to upload, either a file-like object or a string
I assume form['data'] isn't a file like object since it's being passed in a form. If it's a .png that you're passing as text, you should probably encode it as base64 before putting it into couch. Assuming the post works properly and you can save your image into couch, you should see an attachment of the proper size in futon. You can then render your image from base64 simply as shown in this question. If the attachment isn't the size you expect, check to make sure you're actually posting what you think you are.
If you plan on having futon render the image, you may need to give it a more specific content type, since what you passed isn't a normal png but a base64 encoding of a png. Changing content type to
data:image/png;base64
may address the issue.