We are using google doc viewer to view ms-office files
Issue: When we try to view it through Viewer it open the document saying PK
When I searched for the issue I got a helpful link: https://groups.google.com/a/googleproductforums.com/forum/#!category-topic/docs/documents/7j_BXBtQWQg
It says that:Content-Type header sent by your server is incorrect
How can we change/correct Content-Type header send by server in django/python ??
Any help would be greatly appreciated.. Thanks
Perhaps if you serve the file dynamically (ie; rather than using a standard staticfile), you could return an HttpResponse with the contents of the file and then set your own content-type. I've done this with images before:
return HttpResonse(the_file, "Content-Type: image/png")
Where the_file is the actual file data (not the file object).
Would that work for your purposes?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.