我有以下卷曲,将文件传递给我的网址:
curl -F file=@/Users/david542/spreadsheet.xls http://localhost:8000/spreadsheet
在我看来:
@csrf_exempt
def wb_spreadsheet(request):
# how do I get the file??
return HttpResponse('Hello!')
如何在此处理文件对象?
答案 0 :(得分:0)
传递给request.FILES
-
@csrf_exempt
def wb_spreadsheet(request):
file = request.FILES.get('file')
return HttpResponse('Hello!')
答案 1 :(得分:0)