Knowledge Base

Users can't upload their avatars on my IIS server
Article ID: 101
Written By: Gork
Written On: Tue Jul 24, 2007 6:09 am
Description: Tired of the same 'ole "Filetype must be .jpg, .gif or .png" & "Unable to upload file" errors? Perhaps we can help!
link to this article on phpbb.com: Select All
[kb=users-cant-upload-their-avatars-on-my-iis-server]Users can't upload their avatars on my IIS server[/kb]
link to this article on your own board: Select All
[url=http://www.phpbb.com/kb/article/users-cant-upload-their-avatars-on-my-iis-server/]Knowledge Base - Users can't upload their avatars on my IIS server[/url]

The Problem

  • After you install phpBB v2.x on your IIS (the web server included with many Windows releases including WinXP Pro) users are unable to upload avatars from their machine, even though the administrative option is enabled on the board.

  • Users receive errors such as "Filetype must be .jpg, .gif or .png" even though they are attempting to upload a file with the proper extension and within the proper size and dimension restrictions.

  • Users may also receive errors such as "Unable to upload file, DEBUG MODE, Line : 254, File : usercp_avatar.php."

The Cause

The PHP (not to be confused with phpBB) temp directory has not been given the proper write permissions to allow users to upload their avatars. This must be done in addition to the normal step of granting write access to phpBB's v2.x /image/avatars directory when using the IIS web server.

The Solution

Set write permissions on the PHP temp directory.

  • Save the following code in a text file named phpinfo.php and upload it to the IIS server. Point the browser to the file and if PHP is properly set up you will receive a PHP configuration report. Search this report for "upload_tmp_dir" and take note of the directory and complete path listed.

    Code: Select all
    <?php
    phpinfo();
    ?>

  • Navigate to this directory in Windows Explorer, right click on the directory, choose options and select the Security tab. If Internet Guest Account named IUSR_[machine_name] isn't already listed, add it.

  • Assign the following permissions to IUSR_[machine_name]: Read & Execute, List Folder Contents, Read and Write permissions.

Notes

  • This information was taken from a post in the support forums.

  • There are many posts regarding solutions to this problem consisting of code changes to the /includes/usercp_avatar.php file. These changes don't appear to be necessary with this solution.

  • Though these instructions are geared toward IIS users I assume this may be a necessary step for *nix users as well.