hello, there is ajax form, and in it is an input for the picture:

<input id="postimage" type="file" accept="image/*" onchange="load_preview(this, 'post');" name="postimage" style="display: none;"> 

then the image is transmitted in base64 format and saved using file_put_contents.

but what if when loading gif images an error occurs 413 Request Entity Too Large

    2 answers 2

    If nginx (/etc/nginx/nginx.conf)

     client_max_body_size 200M; 

    If apache (/etc/httpd/conf/httpd.conf)

     LimitRequestBody 1073741824 

    You can also register in .htaccess

     LimitRequestBody 1073741824 

      NGinx (2GB) /etc/nginx/nginx.conf :

       server { client_max_body_size 2gb } 

      Apache (2GB) .htaccess || /etc/httpd/conf/httpd.conf || /etc/apache2/conf/httpd.conf :

       LimitRequestBody 2147483647 

      And filter image/svg || image/svg+xml for there may be XSS