Hi there!
TLDR: Can I / How do I export a list of URLs of the files I have uploaded to the file manager portion of the database?
Background: I am trying to pre-fill an app that I am working on with dummy data to explore and explain how the app will work. For that, I am, e.g., creating dummy users with dummy user portraits. I’ve now prepared a number of dummy portraits. Now, I would like to assign the URLs of the stored files to the users that I have set up - thinking of a text field containing the individual URL per user.
I’d love to do this with some CSV-magic and uploading rather than copying every URL per hand. Any chance? I’m sure there must be, but I could not find the solution yet.
Thank you for your help and a great weekend!
Sorry for bumping this up just once, but it seems that this might be possible through a background API workflow - can’t seem to figure it out, though. Any hints on this?
Are you just asking how to assign a URL from an existing list to a field on your User datatype?
I so, where are these URLs currently stored?
Thanks for picking up on this again, @adamhholmes !
I am trying to get a list of all files stored in the File manager. Ideally all information stored there.
I am trying to populate my platform with dummy data - project names, researcher names, and researcher profile pictures (among many other pieces of information). On the page that shows the team of the current user, I’d like to use a repeating group to show those team-members assigned to them, including one portrait each. Setting up the RG is no problem, but I am having difficulties getting the URLs from the uploaded dummy profile pictures to add a profile picture field in my User type.
Now, I have about 30 placeholder images uploaded to the file manager part of the database. For those, I’d love to generate a list of URLs (ideally filename and URL), likely into a “portraits” Data Type which I can then download and assign to my User CSV which I can then upload to assign everyone a portrait.
As usual, I am probably thinking too complicated here. What would work, too, would be if the File manager would just let me export the complete listing of files in the system to CSV.
My problem stems from the special situation that I try to create a site with some dummy data to illustrate functionality - versus having the site populate bit by bit during use. Trying to build a showcase here.
Have you saved the URLs in your database (not in the file manager, but in your actual database?)
If not, you’ll have to manually create them in your database (there are only 30 so it shouldn’t be too hard)…
Then just run a recursive backend workflow to assign one to each User.
Or, if you don’t want to create a datatype for the images (or save them in your database), you could just manually enter the 30 image URLs on to a page (into a multiline input, for example), then send them to a backend workflow to assign one to each User.
there is no need for any CSVs here…
Sorry, didn’t read the full story, so this might be useless for you, but just in case:
To create a list of URLs you can select table in file manager, press Ctrl+C and paste it into Excel. You might need some exercise to clean those URLs as some may appear as <a href=...>
but generally this is a simple way to make list of files from file manager.
I never heard about possibility to list them in the backend workflow. There are several security concerns that need to be addressed such as what account to use to list them, should privacy rules be applied and etc, so I don’t think it is currently possible. You can try to use “list_uploaded_files” endpoint and it’s going to work in the browser (client-side) as long as you are logged in to bubble editor, but you’d need some javascript here to manage it and obviously it’s not documented anywhere, so you can’t use it in production.
If I were doing this I’d probably do the following.
- Create a temporary page in your app with a multiline input
- Copy and paste the file URLs from the file manager (as suggested by @vladimir.pak) into the multiline input (one per line)
- Split that into a list of texts
- Use a find & replace on each item to remove the html tags
- Use the bulk data create API to create a database entry for each URL in the list
- Then use a recursive workflow to assign one image to each User
(you could skip create a database entry for each Image, and just assign the image to the User directly, but it’s often beneficial to have a datatype of images to store your images in the database).
1 Like
@vladimir.pak - thank you so much for pointing me to this extremely useful (and oh-so-obivous) little hack. Of course! Just Ctrl+C the highlighted files to get to the URLs!
@adamhholmes - thank you as well for getting the ball rolling again! I think simply having the URLs in an Excel all in one bunch will make it easy for me to assign them manually in another scrub-and-upload for my User table. I was just wary to manually copy and paste each URL since I felt that this might be happening again some time down the road for another type of file…
Thanks to both of you!
Still haven’t come across anything that Bubble could not or would not do… Usually, the solution is easier than I think I might be.
1 Like