Dear Maksym,

If no name is provided with the download, the browser can provide a name; the behavior might be different dependent on the browser. Therefore, it is recommended to provide the name via the return header field "Content-Disposition", ... or via the "download" attribute in the link. For details, see [1]

all the best

-gn

[1] https://stackoverflow.com/questions/1628260/downloading-a-file-with-a-different-name-to-the-stored-name


ns_register_proc GET /dev/rtrn_file ::dev::rtrn_file

namespace eval ::dev {
  proc rtrn_file {args} {
     ns_set put [ns_conn outputheaders] Content-Disposition {attachment; 
filename="test.csv"}
     set f [file join /tmp test.csv]
     ns_returnfile 200 [ns_guesstype $f] $f
  }
}

_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to