问题描述
错误:无法上传图片,请尝试其他图片 禁止(CSRF 令牌丢失或不正确。):/fileUpload
views.py
@requires_csrf_token
def upload_image_view(request):
f = request.FILES['image']
fs = FileSystemStorage()
filename = "blog/"+str(f).split('.')[0]
file = fs.save(filename,f)
fileurl = fs.url(file)
return JsonResponse({'success': 1,'file': {'url': fileurl}})
urls.py
path('fileUpload',csrf_exempt(upload_image_view)),
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)