Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Add Seperate MD5 File of CSV Download

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Post Reply
pmjd
Posts: 132
Joined: Fri Mar 12, 2021 10:38 am
Has thanked: 3 times
Been thanked: 1 time

Add Seperate MD5 File of CSV Download

Unread post 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
kev1n
nuBuilder Team
Posts: 4301
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Add Seperate MD5 File of CSV Download

Unread post 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)
pmjd
Posts: 132
Joined: Fri Mar 12, 2021 10:38 am
Has thanked: 3 times
Been thanked: 1 time

Re: Add Seperate MD5 File of CSV Download

Unread post by pmjd »

Thanks kev1n, will have a look and see what I can work out.
kev1n
nuBuilder Team
Posts: 4301
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Add Seperate MD5 File of CSV Download

Unread post by kev1n »

Hi Paul,

Were you able to make it work?
Post Reply