[SMF Forum] Cannot access attachments upload path.

Last days I was installing a SMF Forum in a website, but there was a problem. When an user was uploading a file as attachment it returned this error:

An Error Has Occured!
Cannot access attachments upload path.

To fix this problem, go to Admin Panel -> Attachments and Avatars and be sure to write the full path to the attachments directory, for example:

/var/hosting/www/website.com/public_html/forum/attachments

Check that the directory /attachments/ has the right permissions (775 or 777). If this is not enought, you need to edit the php.ini file as follow:

;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;
 
; Enabled HTTP file Uploads
file_uploads = On
 
; Temporary directory for HTTP uploaded files
upload_tmp_dir = /tmp 
 
; Maximum allowed size for uploaded files.
upload_max_filesize = 10M

By editing the php.ini file as above you will set:

  • Upload of files enabled
  • Temporary directory for uploaded files (defined)
  • Set maximum file upload size to 10 MB

Now save and reload your apache:

/etc/init.d/apache reload

If also this will not work, you need to edit again the php.ini file and try to empty these values:

safe_mode_exec_dir = ""
open_basedir = ""

Save and reload your apache:

/etc/init.d/apache reload

It should now be fixed.

NOTE:

If the problems are the above values, you need to set both values to a folder that is accessible by the forum and is inside the folder-tree, for example you can edit the php.ini file as follow:

safe_mode_exec_dir = "/var/hosting/www/"
open_basedir = "/var/hosting/www/"

Create a directory to be used as tmp inside the www folder-tree:

cd /var/hosting/www/
mkdir tmp
chmod 777 tmp

Set the temporary directory for HTTP file uploads to:

upload_tmp_dir = /var/hosting/www/tmp

Save and reload your apache.

Random Posts

Previous Posts