问题
Right now I have a query that will give me results that are broken down into 2000 rows of results. For example if the query is run and there are 16000 results it will break this down into 2000 results per CSV file that the user can download, so there would be 8 download buttons. When the user press the download button it creates a CSV file.
I currently use this in coldfusion to generate the CSV
<cflock name="SFSchoolList" timeout="20" type="exclusive">
<cfheader name="Content-Disposition" value="attachment; filename=UserList.csv">
<cfcontent type="application/vnd.ms-excel">
<cfoutput>firstname,lastname,email,username,password#chr(13)##chr(10)#</cfoutput>
<cfloop query="SF">
<cfoutput>#TRIM(firstname)#,#TRIM(lastname)#,#TRIM(email)#,#TRIM(username)#,#TRIM(password)##chr(13)##chr(10)#</cfoutput>
</cfloop>
</cflock>
This will loop through the SF query to create the CSV when the user clicks the download button from the from.
My question is, how do I go about rewriting this to have it query those results automatically when they press the generate button, when pressed it will write all the possible files to a folder on our server and zip it allowing the user to press a download all button and download the zip instead of individually clicking every download button?
Let me know if you need more code or description on this and I will provide as much as I can. Thanks!
来源:https://stackoverflow.com/questions/27626072/coldfusion-help-creating-a-download-all-button-that-will-zip-all-the-csv-files