Page 1 of 1

Add Seperate MD5 File of CSV Download

Posted: Thu Oct 28, 2021 5:56 pm
by pmjd
Does anyone know how you can add to the "Download to CSV" code in the nuBuilder Code Library so that you also get an additional file that contains the MD5 value for the CSV file?

Thanks,
Paul

Re: Add Seperate MD5 File of CSV Download

Posted: Thu Oct 28, 2021 6:48 pm
by kev1n
I think you'll have to save the file to the server first and calculate its md5. Then write it to a file and download both files to the browser.

Instead of

Code: Select all

$fp = fopen('php://output', 'w');
you would write it to a file on the server

Code: Select all

$fp = fopen('something.csv', 'w');
Then after fclose($fp) use md5_file() to retrieve its md5.

Use fwrite() etc. to write it to a file.

Finally, download both files (example)

Re: Add Seperate MD5 File of CSV Download

Posted: Fri Oct 29, 2021 11:47 am
by pmjd
Thanks kev1n, will have a look and see what I can work out.

Re: Add Seperate MD5 File of CSV Download

Posted: Thu Nov 11, 2021 9:17 am
by kev1n
Hi Paul,

Were you able to make it work?