I’m trying to upload a base64 encoded file to the database. I’ve tried a bunch of different methods and can’t get it to work.
Goal:
I have a page for users to e-sign a PDF agreement. When they e-sign it, I have JavaScript that overlays some text over the original PDF saying that they signed it at this date. I want to save that file to the user’s account in a field of the type “file”. (We’ll call that field “agreement”)
What I’m doing now:
My JavaScript sends a base46 encoded pdf to a JavaScript to Bubble element as a string of text. I’m then able to set the current user’s “agreement” to that JavaScript to Bubble’s value. This is working, but causes several problems:
- The file is still base64 encoded, so it takes more space.
- Also since it’s base64 encoded, there are some issues viewing the file later. Firefox will show the pdf, but Chrome has trouble loading it.
What I’ve tried so far:
Plugins- I’ve tried multiple file uploaders, but haven’t found one that lets you upload through a workflow (even by changing the uploader element from the workflow).
I tried Zeroqode’s Base64 File Uploader & Downloader which looks promising, but I can’t find any documentation on it, and whenever I try to use it it makes my JavaScript to Bubble element throws a DNS error.
APIs- I tried using the undocumented website-home-url/fileupload hack outlined here but I get an internal server error saying there’s a temporary bug.
I also tried using the regular data api and adding the file that way, but I think that left the file in base64 format. (I’ve tried so many things at this point I’m starting forget why each one didn’t work.
Any advice on how to handle this? I’m willing to use a plugin, modify my JavaScript, use API’s or anything else that will work! I just can’t seem to figure this one out.