[dancer-users] Dancer2 before_file_render hook

WK wanradt at gmail.com
Sun Sep 27 21:51:12 BST 2015


Hi!

2015-09-27 22:03 GMT+03:00 Alex Mestiashvili <mailatgoogl at gmail.com>:

> Can I use send_file together with a template ? Let's say I want to render
> html with an image,

Serving HTML and image for this HTML-page are 2 separate requests, you
can't send them together.

Using send_file seems not appropriate, because it sets
Content-disposition-header. Which means: browser downloads a file, but
you want to show it inside HTML.

> Any other ideas ?

For example, you may link this images directory symbolically into
session-named directory and use this name as prefix in your template.

Another way (my preference) is to use some Plack middleware for
authorization and use it as gatekeeper which makes sure, that some
directories (or just files) are accessible only to certain (logged in)
users.

Wbr,
-- 
Kõike hääd,

Gunnar


More information about the dancer-users mailing list