Question

I am dynamically generating a file on Nitrogen Webserver and want the browser to show the name of file in download dialog.

Currently I am setting something like this -

wf:content_type("application/x-download")

This enables the browser to ask for saving the file, but the name of the file is name of the url (which is nitrogen erl page).

How can I set name of file on the content so that browser displays the same filename to user?

I think something like this can be acheived in a Java based server like this -

resp.setHeader("Content-Disposition", "attachment; filename=\"" + fName + "\"");

I'm using Nitrogen on top of yaws.

Était-ce utile?

La solution

You're basically almost there:

wf:header("Content-Disposition", "attachment; filename=\"" ++ Filename ++ "\""),

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top