make sure the permissions are 755 for the directory and write chown www-data:www-data /var/www/html/public/directory-to-upload or chown apache:apache /var/www/html/public/directory-to-upload