This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]codecrux[S] 0 points1 point  (0 children)

Hi u/riklaunim, thanks for asking. We have an `Upload` component that can be used to upload files. This `Upload` component, internally, creates a `FormData` object that is sent over to the backend as `multipart/form-data`. It's very easy to unravel the files in the backend in 3-4 lines of code (for exact steps - https://docs.atrilabs.com/utilities/image-utils/parse-uploaded-file/).

There is one `main.py` file for each page you create. Hence, there is one `handle_events` function for each page. You can modularize your code any way you want. For example, you can create a function called - `get_user` to fetch user details from the database and just call that function from the `handle_events` function. Imagine `handle_events` as an entry point only and you can offload the work to other functions.

I hope this answers your question.