Adding featured image to a new post using front-end form?

Have a front-end form to create a post, Was only able to add text data to the new post (title, content, text-typed custom fields). I want to add a featured image to the new posts too.

It’s a WordPress site and I use Avada theme. The custom post type is the Avada’s default Portfolio post. But generalised answers would be very helpful too (please give some explanation on your code).

Please add some code to my PHP code and the form so that it can save a featured image too.

So, Here’s my php code in fuctions.php in my child-theme:

My front-end form: