You may encounter issues, certainly when migrating a WordPress website to a new web server, with WordPress images not displaying when using IIS.
Uploaded images get created on disk ok, but when viewed in a browser either from the post editor OR the published blog itself, it doesn’t display.
The reason is typically permission related. By default, when we upload blog images using WordPress IIS temporarily uploads files to C:\Windows\Temp before copying to the wp-content\uploads folder (this location can be overridden by setting the upload_tmp_dir
value in PHP.ini).
If C:\Windows\Temp has the wrong permissions, it will copy the file to the uploads directory with permissions that are not readable in the web browser. The solution is to give IIS_IUSRS read and execute permissions to C:\Windows\Temp (or whatever your upload_tmp_dir
is set to) and any subsequent image upload issues will be resolved.
If you need to retrospectively fix the issue, you may need to navigate to your uploads directory and manually apply these permissions.