我的 HTML 代码:
<form action="/set_image" method="post" id="form1" runat="server" enctype='multipart/form-data'>
<div class="fileButtons">
<input type='file' id="imgInp" name="imgInp" accept="image/*"/>
<input type="submit" id="submit" name="action" value="Send"/>
<input type='button' id='remove' value='Remove' />
</div>
</form>
主要.py:
class SetImage(webapp2.RequestHandler):
def post(self):
id = str(self.request.get('id'))
image = str(self.request.get('imgInp'))
if (image):
set_image(id, image)
self.response.out.write("Image Uploaded")
else:
self.response.out.write("No Image Selected")
我能够得到图像,但是当我尝试打印它时 id 是空的。