Dynamically upload Background image

I am creating a website and there is an option for the user (after he login to the website, he enters into his workspace page)to upload a background image of his choice to his workspace page.

Can the user dynamically upload a background image to his webpage?

Can this be done in javascript/php?
I would be glad if somebody could help me.

You can upload the image via a <form> and <input type=“image”… and if the upload is successful, redirect back to the original page with the uploaded file name attached in the url’s query string.

At the top of the web page, check if a query string exists. If it does, then assign the attached file name as the bg image in the css using php.