Home

Creating a Page Export Function

Need to create an 'export' function for a page? Do it quickly and cleanly with HTTP::sendFileToBrowser. In your page controller, add a new action 'export':

Now you just need to create Page_Export.ss, and direct the user to the URL "/export/". Your page will be returned to the browser as an attachment to download.

 

About the Author

Name: Hamish Campbell

Website: http://polemic.net.nz/

Hamish is a web developer for Opus International Consultants in New Zealand. He creates tools for managing data online, with a particular interest in geographical information systems. He is also an active contributor to the SilverStripe open source project. You can find Hamish on twitter (@polemic) or catch him at his ever-neglected web home http://polemic.net.nz/.

Comments (2)

  • , with a particular interest in geographical information systems. He is also an active contributor to the SilverStripe open source project.

    Posted by replicas handbag, 02/08/2010 4:08am (1 month ago)

  • I tried implementing this snippet but perhaps I am missing something, when I type in /export/ from the page I'd like to export, I get a 404 page (if after domain) or a "forbidden" message if /export/ is appended to the page URL... Any ideas on how to fix this?

    Posted by FS, 10/11/2009 9:36pm (10 months ago)

RSS feed for comments on this page RSS feed for all comments

Post your comment