How can I create a page from frontend & upload a files to that page simultaneously

Hi there, I’m working on a interview submission form that create a draft page in the panel and I’ve been using these two guides:

My issue now is how can I connect the two together?