This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Download file real time
#5
(20.11.2020, 06:57)admin Wrote: You can use .lp file to generate a CSV that will be sent to the user.
First you need to attach an event to a button that will open .lp in a new window:
Code:
$(function() {
  // additional class must be set to csv
  $('.csv').on('vclick', function() {
    window.open('/user/csv.lp');
  });
});

Use this as a starting point for csv.lp:
Code:
<?
-- set headers for csv file download
setdlheader('text/csv; charset=utf-8', 'report', 'csv')
-- generate csv here
csv = '...'
-- output to the user
print(csv)

Hi admin,
sorry but do not understand program language above. If I use <? LM inform me "Lua syntax error at line 1: unexpected symbol near '<'".

Thanks.
Reply


Messages In This Thread
Download file real time - by Domoticatorino - 19.11.2020, 21:11
RE: Download file real time - by admin - 20.11.2020, 06:57
RE: Download file real time - by Domoticatorino - 24.11.2020, 07:00
RE: Download file real time - by Daniel - 20.11.2020, 08:26
RE: Download file real time - by admin - 24.11.2020, 07:34
RE: Download file real time - by admin - 24.11.2020, 09:16
RE: Download file real time - by admin - 24.11.2020, 09:56
RE: Download file real time - by admin - 24.11.2020, 10:33

Forum Jump: