我在Chrome浏览器中收到ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION,并在Django中使用以下给定代码。
redirect_path = 'some-url'
response = HttpResponseRedirect(redirect_path)
response['Content-Disposition'] = 'attachment; filename=file-from-+324#10,+4324.mp3'
return response
Run Code Online (Sandbox Code Playgroud)
事情正在其他浏览器中找到。
请让我知道我在这方面做错了什么。
问题是文件名中有逗号。您应该在文件名中引用标题。我测试了以下视图在Chrome中的工作原理。
def my_view(request):
response = HttpResponse('hello')
response['Content-Disposition'] = 'attachment; filename="filename,with,commas.txt"'
return response
Run Code Online (Sandbox Code Playgroud)
有关更多信息,请参见Chrome帮助论坛上的讨论。
归档时间: |
|
查看次数: |
938 次 |
最近记录: |