I'm generating a very useful
.dat file, but I read that
file_put_contents if frowned upon and that
WP_Filesystem should be used instead.
I see no methods to take dynamic input and create a file and then upload it to a directory of my choice at all.
What functions out of it should I look for?
My exact flow is: User clicks a button (the call is AJAX'd) and then 3 files are generated and put inside my directory. As of now, this is how the "save file" function looks like:
ob_start(); generateExprotFile(); $contents = ob_get_clean(); \file_put_contents( THEME_DIR . '/dump/test.dat', $contents );