def postimage(req): if not req.session.get('isLogin'): return HttpResponseRedirect('/zhiyuw/login') uid = req.session['info']['id'] utype = req.session['info']['utype'] if req.method=='GET': return HttpResponse("unsupport method") # print req.FILES.keys() data = imageUp.imageup(req.FILES['upfile']) # print req.GET if 'editorid' in req.GET or 'type' in req.GET: return HttpResponse(json.dumps(data),content_type="application/json") if data['state']=='SUCCESS': if controller.update_photo_img(data['abs_url'], utype, uid): return HttpResponseRedirect('/members/profile') msg = '上传头像失败' return render_to_response("members/msg.html", locals(), context_instance = RequestContext(req))
def postimage(req): if req.method == 'GET': return HttpResponse("unsupport method") # print dir(req.FILES) data = imageUp.imageup(req.FILES['upfile']) return HttpResponse(json.dumps(data), content_type="application/json")
def postimage(req): if req.method=='GET': return HttpResponse("unsupport method") # print type(req.FILES['upfile']) data = imageUp.imageup(req.FILES['upfile']) return HttpResponse(json.dumps(data), content_type="application/json")