I have noticed recently some users asking about converting files to base64 encoding for use in API's.
While Sid has previously produced an extension for something like this I have produced a variation on this idea which allows the file to not only be converted and output but also to be saved.
This uses no additional external libraries
This extension takes a file path and returns the file as a base64 encoded string.
Also, optionally (set by checkbox), the file can be written back in it's base64 form to a path for subsequent use.
Not extensively tested but seems to be working perfectly on my system.
Any issues, let me know or any suggestions for improvement welcome
It's just a preparation for the future, I don't personally need it
Even Wappler steps like CSV handling are so bizarre in the sense they need a file path to import. One can't import directly from an incoming POST request, you have to write to a file first...
I'm under the assumption file uploads will be accessible in a $_POST variable as an array of bytes somehow, don't know how true is that in Wappler context
I don't think so, the data is not actually part of the $_POST variable, the actual file is, i believe, uploaded to the server's temporary folder and would need to be accessed via the $_FILES superglobal
Accessing form POST directly is looking problematic. If it had been a quick fix i would have done it but conscious i am getting distracted from my main projects of Customs extensions series and integration of Onesignal.
May come back to it later.