XF 1.4 Error while uploading and Image.

James Jimmy


I am running a website called www.forumhuru.com , and recently whenever I want to upload an Image in the classified section / forum ,most of the time it says "The following error occurred while uploading your file " ,sometimes I'm able to upload sometimes it says "The following error occurred while uploading your file" . How can I fix this ??

Thank you.


XenForo developer
Staff member
Does this happen with images or any size? Does it happen with non-images?

In your preferences, please try disabling the Flash uploader. Does that help? If no, what happens?

Nicky Vermeersch

Active member
Sounds very much like a problem that can happen when the php upload size limit is set to default. I had similar issues. I could only upload relatively small images, but starting from a few megabytes there were problems. I had to increase both my php upload limit and modify nginx configuration in order to upload larger files. @James Jimmy could you check what your upload limits are for php, and what kind of web server are you using? (nginx, apache, lighttpd, ...)

James Jimmy

yes it happens with images only. It doesn't happen with non images. I have disabled the Flash uploader, and now its okay. But its kind off monotonous compared to when you enable the flash uploader and upload images in large quantities. @Mike ,in this one you upload an image one in a time.

Nicky Vermeersch

Active member
I'm using linux, but the php configuration file there is located at /etc/php.ini
The following settings are particularly of interest to you in that file:
; File Uploads ;

; Whether to allow HTTP file uploads.
; http://php.net/file-uploads
file_uploads = On

; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
; http://php.net/upload-tmp-dir
;upload_tmp_dir =

; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 800M

; Maximum number of files that can be uploaded via a single request
max_file_uploads = 50
I marked the changes I did in bold, the standard values are much lower. In this case someone can upload a maximum of 50 different files during a single request, and the files can be up to 800 Megabytes.
Since im using nginx, it also required an additional change since file uploads are passed through nginx. Nginx configuration can usuallly be found under /etc/nginx/nginx.conf or under the /etc/nginx/conf.d/ directory for per-site configuration files. In the HTTP server block (I did it in nginx.conf since that would affect it globally for all my websites, without the need to do per-site configuration changes) you want to put client_max_body_size 800m; so the server block would look like something like this:

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    client_max_body_size 800m;
    keepalive_timeout   65;
    types_hash_max_size 2048;
    gzip on;
    gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    #fixes long urls in server block
    server_names_hash_bucket_size 64;
Make sure its the same size as you set in the php.ini file. After you did all that you just need to reload the php-fpm and nginx services with systemctl restart <servicename>.

James Jimmy

Hello @Nicky Vermeersch , I tried recently finding the location of php configuration file but I haven't been able. Could I ask you, should I go to the admin panel of my website which is www.forumhuru.com to locate the php configuration and make the change of "client_max_body_size" ?? And I am using Windows :(

Thank you !!

Nicky Vermeersch

Active member
The php.ini file is a system configuration file, it is not available for edits through the Xenforo admin panel. You need either root access, or some sort of software like cPanel/Plesk that allows you to make changes to the system's configuration.