[英]How can we compare request object in django?
I am building a website in django where user can upload their apk and the app will be modified by server and it return back the modified apk but there i have to limit user to upload 1 apk from 1 category at a time.我正在 django 中建立一个网站,用户可以在其中上传他们的 apk,该应用程序将由服务器修改并返回修改后的 apk,但我必须限制用户一次从 1 个类别上传 1 个 apk。
if(request.FILES["app"]):
name = request.FILES["app"]
elif(request.FILES["lib"]):
name = request.FILES["lib"]
elif.... And more
But i am facing some multivalue dict key error anyone knows any better solution for this please suggest me.但是我面临一些多值字典键错误,任何人都知道对此有更好的解决方案,请建议我。
You can check if the key is present in the file with:您可以使用以下命令检查文件中是否存在密钥:
if
'app' in request.FILES:
name = request.FILES['app']
elif
'lib' in request.FILES:
name = request.FILES['lib']
# …
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.