Easiest way to rename a file that is stored in a DB field?

So I have a table, Case, that has a field (agreement, file). Each time a new invoice (another table) is generated, I need to copy that agreement file into the invoice (has a corresponding field: agreement, file), but rename it in a dynamic format: {invoice_number}F.{file_extension}.

So I’m not sure what the best way around this problem is. It could be done in a BEWF as well. I just am not sure what would be the best way of doing this.

What I am trying based off bits and pieces I can find is the follow:

I used the detect request data in the workflow to initialize it, but even though it detects “file” as the contests list data, it is not usable as a file (it’s seen as a list of files) and I’m not sure how to decode or recode it and save it to bubble storage using my filename parameter.

Bumping this up as I’m still stuck here. Any help is appreciated.

I ended up finding this plugin that saved the day for me: File Uploader Bubble API Plugin for Bubble | Zeroqode

I was then able to run a BEWF using the original file, then renaming it, then attaching it to the new invoice.