Fixing WordPress Image Upload on a Windows Server (Permissions Problem)

Fixing WordPress Image Upload on a Windows Server (Permissions Problem)

If any of you like me are hosting your WordPress blog on a Windows machine you may have had issues when uploading images/media using the admin interface.

When I tried to upload images or any media for that matter – it would upload but then the thumbnail of the image itself was greyed out. If I attempted to navigate to the URL of the image it would just display the classic red cross in the browser aka. Can’t find image!

After a bit of research it seems that PHP puts uploaded items in the temp directory (‘C:WindowsTemp’) and then once the upload is complete wordpress copies the file to the wp-contentuploadsyearmonth folder.

The reason that you cannot view the image in the browser is a permissions issue. When wordpress/php copies the image to the wordpress uploads directory it uses the permissions that are currently set on the temp directory.

To fix this problem simply give the ‘IUSR’ account Modify permissions on the WindowsTemp directory and restart IIS.

Next time you upload an image it should work correctly.

Hope this helps!

6 thoughts on “Fixing WordPress Image Upload on a Windows Server (Permissions Problem)

  1. Darren W

    Hi,

    There’s also the option of changing the “upload_tmp_dir” directive in PHP.ini (and even better if per site PHP configuration is available), if you don’t want/can’t change the permissions of the C:WindowsTemp directory.

    For multiple sites on the same physical server, I always create a temporary directory for each, just to keep things separate. I get worried when a web application writes anything to C:Windows* :-)

  2. Pingback: IIS_IUSRS cannot access files uploaded and created by Network Service – error 401.3 - Admins Goodies

  3. Manitra

    Thanks for this tip !

    Just another important thing about the “upload_tmp_dir” : there are 2 occurence of that key in the php.ini file and (of course) the important one for my setup was the second one in the [WebPIChanges] section !

    Manitra.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">