Can’t upload media to my Raspberry Pi WordPress server

you need to change the owner of the wordpress folder to www-data.

For example, if you put your wordpress folder in /var/www/my_new_wordpress_site, you will need to run the following command:

sudo chown -R www-data:www-data /var/www/my_new_wordpress_site