Learn How-to Upload and Share Files with Users in Your App
For some apps, there’s a need for users to upload files that they can retrieve later on or even share with other users. Whether you have PDF’s, Word docs, Spreadsheets, etc., with Bubble.io you can quickly and easily provide your users with the ability to upload files. In this first video and a supplementary second video, you’ll see how-to implement not only file uploading capabilities but also how to share files with other users.
To support this capability, you’ll need to create a new Custom Data Type which will have two Data Fields in it. The Custom Data Type in the video is “Data File” with the Data Fields being “Document” and “WhoCanSeeFile”. “Document” has a type of “file” and “WhoCanSeeFile” is “List of Users“. Another data structure change is the addition of “Team Member” (type “List of Users“) under “User” Data Type. This will allow the person logged in the ability to select which other Users can have access to their files. The first workflow image below shows the step to add a User to the “Team Member” list.
The workflow image below shows how “Team Members” gets added to “WhoCanSeeFile”. This workflow starts when “FileUploader A’s value” changes. When you click the button to upload a file, a popup will open to select a file. After you select the file, this workflow wills start.
NOTE: You need to use “add list” when adding “Team Members” to “WhoCanSeeFile”. If you use “add” then the workflow won’t work; you’ll get a Bubble error if you use “add“.
The second part of the app design uses a Repeating Group to show the list of users you have given file access to. NOTE: Typically Repeating Groups have a Search command in the Data source field. Since you’re creating “Team Members” which is part of Current User’s data structure, you can use “Current User’s Team Members” directly instead of doing a search.
In the two videos you’ll see this design in greater detail, including some user experience design to give user’s visual cues. Having the ability to upload and share files can help increase the value of your app to your users. Check both the first and second video to learn how you can implement this functionality in your app.