MyBB Community Forums

Full Version: Avatar upload problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

when I try to upload an avatar in the user-cp i get the following error:
Warning: fopen() [function.fopen]: open_basedir restriction in effect. File(/tmp/phpCSDDus) is not within the allowed path(s): (/home/www/htdocs/XXX/.) in /home/www/htdocs/XXX/forum/usercp.php on line 1051

Warning: fopen(/tmp/phpCSDDus) [function.fopen]: failed to create stream: Operation not permitted in /home/www/htdocs/XXX/forum/usercp.php on line 1051

Warning: fread(): supplied argument is not a valid stream resource in /home/www/htdocs/XXX/forum/usercp.php on line 1051

Line 1051 is:
$avatarfile = addslashes(fread(fopen($HTTP_POST_FILES['avatarupload'][tmp_name], "r"), $avatarsize));

What's that?
You're restricted from opening anything from the /tmp/ I think. Check with your webhost on how you can access uploaded files from PHP. I think it's a problem with the php.ini or you're in safe mode. It's not a MyBB problem.
i think this may be able to be fixed, if it gets changed to use move_uploaded_file instead of reading the file direct from the tmp dir.

I'm not totally sure though
Move it to a MyBB directory, then read it again? Because you can't move it straight to the database.