Transcript
In this Quick Tip, we're going to learn about the File Uploader element. If you want your users to upload a file, then the File Uploader element is what you need! It's very similar to the Picture Uploader element, but it's specifically meant for users to upload files to your app.
When we draw this element on the page, we get an uploader that, when the user clicks it, will be able to pick any file to upload to their app. Uploading the file from this element immediately saves it to your app's File Manager, which adds it to your app, but not to a thing in your database.
We do this so you have control over who can view the file via Privacy Rules. Without the file being attached to a thing, the file is public. In the File Uploader's Property Editor, we have a property to "Make this file private".
When you check "Make this file private", you can attach it to the Current User or any other data type that you search for. Now when a file is uploaded and we view it in the File Manager, it will attach to the thing we defined - in this case, the Current User - so we see the user's unique ID.
With Privacy Rules on the User data type, we would make sure that whoever meets the rule can view attached files. You can also add files to custom fields, though this isn't the same as attaching them for privacy; this associates the file to a field in a thing, which is how you would retrieve them to display the file or offer for it to be downloaded.
Finally, you can set defaults or even auto-bind the value to a field, as well as set the max file size that users can upload (up to 5 gigabytes).
That's it for this Quick Tip! For more, be sure to check out bubble.io/academy.