HTML forms in cloudflare pages + basic authentication

Hi guys,
I have my Cloudflare page hosted successfully serving my index.html
My Cloudflare page currently

I would like to create a new html page with a form that can be accessed from the url such as /upload
which will process the form and save the data somewhere maybe my mongodb server.

How can i use Cloudflare pages + workers/functions to implement this sort of feature.
I also would like /upload page to be secured with some sort of basic authentication.

There is a tutorial available here:

If you are on the R2 Beta, you will soon be able to store the assets in R2.

Multiple options. You could put Cloudflare Access in front of the /upload pages. You could also implement basic auth in the Function itself. An example is here. If doing Basic Auth, make sure you force HTTPS using the “Always Use HTTPS” setting.


Functions can’t currently bind to a R2 bucket but it’s on the way!