Hi! I’m building my first app in Bubble and it seems I’m stuck trying to upload files to a field in my database.
I’ve tried a couple of Plugins (“Download, Save and Create File” by Renato Asse and “XML and TXT Generator” by Grupo Ima). With both plugins I have succesfully created and uploaded XML files to the File Manager from information obtained from an external API. But I don’t find a way to link the new files directly to the field where I need them for future access, without downloading and uploading them manually.
To upload them manually is not an option. This will be a recurring process that should not be noticeable for the final user.
It seems such a simple step, that I’m sure it must be possible and I’m overlooking something… If anyone can help or recommend a Plugin that could solve this problems, I’d be really grateful.
I’m creating the XML files with this plugins, but the information to create them is actually coming from an API that responds with the XML file that I need to store. Maybe there’s a way to store the received file directly without processing or “creating a new file”. That would also solve my problem.
Hi! I’ve run into this before, the key is that Bubble file fields store URLs, not the actual file, so you don’t need to manually upload anything.
Here’s how you can do it,If your API returns a downloadable file URL: Use the API Connector to call the API.Set the API call to return a file.In your workflow, create or update a thing, and set your file field to the API call’s response. Bubble will automatically save the file. If you’re generating the file via a plugin: Most plugins output a file URL. Right after that action, create or update a thing → set your file field to the plugin’s file URL. If your API returns base64 instead of a file: Use a plugin like “Base64 to File” to convert it, then save the result to your file field.
This will make the whole process fully automatic, with no manual uploads.
If you’re open to it, I’d be happy to discuss this further and even show a workflow setup that handles this smoothly.
If you have set the response to File, Bubble already save the file in your Bubble storage and provide the link to so you can attach the file to an item. However, this file is not set as private. You may need to use a plugin for that.
I had been scratching my head for a while, and this solves my problem.
I’m sadly running into a new problem now. I need to both store the file and also extract a couple of fields from the XML. As I was previously using the API connection as “Data”, I could access the information. But now that I changed it to “File”, it seems not possible now.
And I cannot run the API connection twice (once to store the file and a second time to extract the information), because I will get a mismatch between the stored data and the file.
I have been trying some plugins to extract the data from the stored XML file after running the API connection that gets the file, but I haven’t been succesful yet. Do you know if this is possible? Or can you recommend a plugin to extract information from an XML file stored in the database? Maybe there’s a way to both extract the information and store the file in the same API call…
You are pointing in the right direction too. Any help with the new problem that I’m describing in my response to @dtempest006 will be very much appreciated!!
Or you can let bubble parse the xml response from API like before, but activate detect header and continue if error. This will give you access to raw body that you can save as file using a file creator plugin.
I realized that I can infer the data that I was planning to extract from the XML, from other info in the app. Some exceptional cases may cause trouble, but I think it will be better to keep the app simpler and manage those exceptions manually.
I will keep the response to File and store that file without processing. I will run some tests and see how well this solution works.
I’m really thankful with both @Jici and @dtempest006 for your quick and helpful comments!!