Reputation: 1344
Hi i want to rename the a file that can be downloaded from the website.
This is how i populate the response.
return response()->view('ordersxml.order-template',compact('order','debtor','today'))->header('Content-Type','text/xml')->header('Content-disposition','attachment')->header('filename','test');
The ->header('filename','test');
Is not working. What am i doing wrong?
THanks in advance
Upvotes: 3
Views: 15401
Reputation: 54831
Of course, you can add header filename
, but it won't work, because proper header for download is:
Content-Disposition: attachment; filename="filename.jpg"
So, you code should be:
return response()
->view('ordersxml.order-template',compact('order','debtor','today'))
->header('Content-Type','text/xml')
->header('Content-disposition','attachment; filename="test"'));
Upvotes: 10