Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content-Disposition: attachment not work for txt file in Kindle #526

Closed
ChenZhongPu opened this issue Nov 26, 2018 · 2 comments
Closed

Content-Disposition: attachment not work for txt file in Kindle #526

ChenZhongPu opened this issue Nov 26, 2018 · 2 comments
Labels

Comments

@ChenZhongPu
Copy link

I am using nanohttpd in Android as a http server.

     Response response = NanoHTTPD.newChunkedResponse(Response.Status.OK, mime, fis);
     response.addHeader("Content-Disposition", "attachment; filename=\"" + WebUtil.localFileName +"\"");
     return response;

When the file mime is application/x-mobipocket-ebook (I have updated the mimetypes file), it can download directly in Kindle. But when it is plain/txt, it will display it inline.

@ChenZhongPu
Copy link
Author

I would like to force it to download instead of displaying.

@LordFokas
Copy link
Member

The mime is the Content-Type response header. That should be enough to force a download, since it's a mime browsers don't typically know how to display.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants