mdshack / shotshare

Open source image sharing application
https://demo.shotshare.dev/
MIT License
138 stars 10 forks source link

Configurable max file size #26

Closed EmberHeartshine closed 6 months ago

EmberHeartshine commented 10 months ago

After experimenting a little with various files, it looks like 2 MB is the maximum upload size. I'd like that to be configurable, though I didn't see where in the code that's actually defined (so I could be mistaken). I've made sure my nginx reverse proxy is set to accept client body sizes larger than that.

EmberHeartshine commented 9 months ago

I found the appropriate Caddy directive; I don't know how you'd make that configurable at runtime but it's something at least.

KevinGuest commented 9 months ago

Ensure you update your php.ini to prevent an entity too large error from popping up as well as the default php upload is I think 2M or 10M?

Lines to edit in php.ini upload_max_filesize = 10M (set to expected file size) post_max_size = 10M (set to expected file size)

I don’t think this is configurable via a webpage unless a installer / setup is created where all packages are installed then a page is created where you can set your values per certain packages during that web installation prior to production. Other than that this is something that would need to be manually configured.

EmberHeartshine commented 9 months ago

Since this is a Docker image it is preferable for this to be configurable using files that will be persistent, which php.ini is not. Nor should system/uid 0-owned files be bind mounted.

KevinGuest commented 9 months ago

Since this is a Docker image it is preferable for this to be configurable using files that will be persistent, which php.ini is not. Not should system/uid 0-owned files be bind mounted.

Ah I thought you had this separated from docker based on another issue posted.

See these, might be of use.

https://stackoverflow.com/questions/63072249/docker-compose-set-variable-in-php-ini-from-dockerfile

https://forums.docker.com/t/how-to-get-access-to-php-ini-file/68986

EmberHeartshine commented 9 months ago

Those are still not persistent fixes. Re-downloading the image (for updates etc) doesn't save that config. I'm trying to suggest a more user-friendly approach to this, and editing docker-compose files is not that.

BuyMyMojo commented 7 months ago

Adding these lines to a .ini file like in this docker file should work

https://github.com/phpmyadmin/docker/blob/272944cc5a10f7740acacbe2a35c2c1f6d9a98c7/fpm/Dockerfile#L74C1-L75C48

mdshack commented 6 months ago

Just added this capability, it is currently available on the main branch, will be delivering it with the 1.10 release in the next few minutes.

EmberHeartshine commented 6 months ago

Not fixed. My .env file was updated with the following lines:

PHP_UPLOAD_MAX_FILESIZE=16M
PHP_POST_MAX_SIZE=64M

and when I attempt to upload an image larger than 2 MB, I get the following error:

Screenshot_20240414_213709_Fennec

EmberHeartshine commented 3 months ago

Still not fixed. The PHP_POST_MAX_SIZE and PHP_UPLOAD_MAX_FILESIZE envvars still aren't being respected. I cannot upload anything larger than ~8 MB, since that results in the error below. Attempting to upload anything between 5 MB and 8 MB results in the same error I got in the previous comment. My vars are unchanged from the previous comment.

Screenshot_20240726_134017_Fennec