snipe-it icon indicating copy to clipboard operation
snipe-it copied to clipboard

docker version picture upload size limited

Open Syntax3rror404 opened this issue 2 years ago • 6 comments

Debug mode

Describe the bug

I using this fantastic application within a docker container behind a NGINX reverse proxy. I can't upload product pictures bigger then 2MB. How can I mange this problem? The NGINX reverse proxy allow upload size 5 GB

Reproduction steps

  1. Login
  2. Create a new asset
  3. Upload a 5 MB product picture

Expected behavior

docker environment variable to set max upload size

Screenshots

No response

Snipe-IT Version

5.4.1

Operating System

Centos 9 Stream

Web Server

NGINX

PHP Version

official docker container

Syntax3rror404 avatar Mar 16 '22 18:03 Syntax3rror404

Please add a env variable witch setup the php config upload_max_filesize and post_max_size inside the /etc/php7/php.ini file. I think this can be done with the entrypoint.

Syntax3rror404 avatar Mar 17 '22 12:03 Syntax3rror404

We would be happy to take a Pull Request that implements this feature.

uberbrady avatar Mar 17 '22 12:03 uberbrady

@uberbrady Isn't there already a variable that controls the upload_max_filesize in the php.ini?

# Fix php settings
if [ -v "PHP_UPLOAD_LIMIT" ]
then
    echo "Changing upload limit to ${PHP_UPLOAD_LIMIT}"
    sed -i "s/^upload_max_filesize.*/upload_max_filesize = ${PHP_UPLOAD_LIMIT}M/" /etc/php/*/apache2/php.ini
fi

From https://github.com/snipe/snipe-it/blob/master/docker/startup.sh

Is the -v flag even correct in this case? I'm no shell script writer but looking for the -v flag returns nothing. Should it not be -n?

GitHub
A free open source IT asset/license management system - snipe-it/startup.sh at master · snipe/snipe-it

nuraeil avatar Mar 17 '22 13:03 nuraeil

Without also changing the post_max_size variable inside the php.ini to the same or bigger value it doesn't work see https://www.php.net/manual/de/ini.core.php#ini.upload-max-filesize

-v is used to mount a directory to the container -e is for passing variables

Syntax3rror404 avatar Mar 17 '22 13:03 Syntax3rror404

Try docker run -e PHP_UPLOAD_LIMIT=8M ... snipe/snipe-it

RedShift1 avatar Jul 06 '22 09:07 RedShift1

Try docker run -e PHP_UPLOAD_LIMIT=8M ... snipe/snipe-it

That was working for me! Thank you very much!

thomas-mc-work avatar Aug 03 '22 08:08 thomas-mc-work

Anyone using Azure can add PHP_UPLOAD_LIMIT=8 to the application settings

Karl-Dorreen-AsBuilt avatar Oct 10 '23 08:10 Karl-Dorreen-AsBuilt