After a lot of trouble and searching on the internet, I found a solution on the forum of WordPress: https://wordpress.org/support/topic/http-error-on-media-upload-wp-39
Apparently ImageMagick is broken, I am trying to contact the hosting company to check this, but in the meanwhile this solution fits for me. Download the zip file of the git repository: https://github.com/getsource/default-to-gd
Now, upload this zip file as a plugin in WordPress and the problem is fixed!