I am converting a data conversion script over to ModX.
The way the script is written is the script asks for a file which is uploaded and then the data is converted into the appropriate format and then returned as a text file attachment. My question is how to display the file as a downloadable attachment from within a snippet in ModX. Are headers sent prior to the snippet or can I go ahead and set my headers when needed? Do I have to delete the output already assembled for display by ModX and if so, how?
Have I confused everyone?
Recapping ...
(1) Script displays a form asking for the user to upload a file
(2) Upon submitting, data is sent to same page, but this time instead of displaying on the screen (unless there are errors) the data is assembled as a text attachment to be downloaded.
Any insight? Thanks in advance for your help!!
Create a new document to hold your processing snippet call with the settings blank template and content disposition attachment.