When the browser requests https://www.my-website.com/download.pl?file=path1/path2/filename.ext , you need to respond with the Content-Disposition header. Depending on what way you use to send headers, this might need different code. For Mojolicious, you send headers like the following:
use File::Basename 'basename'; ... # Serve static file if it exists if (my $asset = $c->app->static->file('path1/path2/filename.ext')) { $c->res->headers->content_disposition('attachment; filename=filena +me.ext'); $c->reply->asset($asset); }
In reply to Re: Download file to browser
by Corion
in thread Download file to browser
by david.woosley
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |