Homepage
Main navigation
Main content
Additional information
October Tricks
Login / Sign up
Quality Guidelines
About
GitHub
Propose new content
October CMS resources and help articles
Simple and to the point. Optimized by the community.
×
Login / Sign up
Quality Guidelines
About
GitHub
Propose new content
Edit trick
Changes will be published after manual review
Title
Give your trick a describing title. Do
not
start with «How to...».
Your trick
Keep it short and concise! Markdown is supported.
Currently it is not possible to return a download response from an AJAX handler. You have to use a dedicated route or page that returns the response instead. ```php title = "Download" url = "/trigger-download" is_hidden = 0 == function onStart() { $pathToFile = storage_path('your-file.pdf'); $fileName = 'download.pdf'; $headers = [ 'Content-Type' => 'application/pdf' ]; return Response::download($pathToFile, $fileName, $headers); } == ``` You can redirect to this page from any AJAX handler and the browser will start a file download. ```php function onDownloadHandler() { return Redirect::to('trigger-download'); }
References
Add additional online resources to your trick
×
Name
URL
+ Add reference
Topics
If your trick fits more than one topic select multiple. Select at least one.
Backend
Plugin Development
CMS
Twig
Themes
Deployment
Tags
You can use existing tags or create new ones. Add at least one.
Submit for review
Cancel
We use cookies to measure the performance of this website. Do you want to accept these cookies?
Accept
Decline