Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload File Help-Block allowed file size is 8M but actual is 2M #6251

Closed
2 tasks done
tmvillain13 opened this issue Sep 28, 2018 · 42 comments
Closed
2 tasks done

Upload File Help-Block allowed file size is 8M but actual is 2M #6251

tmvillain13 opened this issue Sep 28, 2018 · 42 comments
Assignees
Labels

Comments

@tmvillain13
Copy link

Please confirm you have done the following before posting your bug report:

Describe the bug
While uploading a file onto Asset via "Upload" button or "Edit Asset" and "Select Image" in the bottom, the help-block states that allowed maximum file size is 8M, but actual allowed file size is 2M

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Asset'
  2. Click on 'Upload'
  3. Select File more than 2M and less than 8M

Expected behavior

File is Uploaded
OR
Help-Box show 2M
OR
I would have this setting added to the snipeit ENV

Screenshots
image

Server (please complete the following information):

  • Snipe-IT Version -> v4.6.4 build 3885
  • OS: Docker container on QNAP NAS
  • PHP Version -> 7.0.30-0ubuntu0.16.04.1

Desktop (please complete the following information):

  • OS: Windows 10, Android
  • Browser [chrome, opera, chrome mobile]

Smartphone (please complete the following information):

  • Device: S8 Samsung
  • OS: Android
  • Browser Chrome

Error Messages
he given data failed to pass validation.
/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/FormRequest.php#125
Illuminate\Validation\ValidationException

Demo server has 1024M help-box, I tried to upload 700M it did work.

Additional context

  • this is a fresh install
  • QNAP
  • Docker
@tmvillain13 tmvillain13 changed the title Upload File Help-Block states 8M as allowed file size but actual is 2M Upload File Help-Block allowed file size is 8M but actual is 2M Sep 28, 2018
@EarlRamirez
Copy link
Contributor

Are there any file size restrictions on your web server?

@tmvillain13
Copy link
Author

No, it is my own NAS

@tmvillain13
Copy link
Author

tmvillain13 commented Sep 29, 2018

@EarlRamirez
I have copied a custom .ini file into /etc/php/7.0/apache2/conf.d of my docker container of the snipeit

with the next lines:
upload_max_filesize = 8M
post_max_size = 8M

And it started to work.

So I assume there is still a bug in the default docker image, how this setting is set and / or used in code.

image

@EarlRamirez
Copy link
Contributor

@tmvillain13 thanks for the update, never used the docker images but will certainly have a look and create a PR if your solution doesn't create any conflicts.

@stale
Copy link

stale bot commented Dec 3, 2018

Is this still relevant? We haven't heard from anyone in a bit. If so, please comment with any updates or additional detail.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Don't take it personally, we just need to keep a handle on things. Thank you for your contributions!

@stale stale bot added the stale label Dec 3, 2018
@tmvillain13
Copy link
Author

UP

@stale
Copy link

stale bot commented Dec 4, 2018

Okay, it looks like this issue or feature request might still be important. We'll re-open it for now. Thank you for letting us know!

@stale stale bot removed the stale label Dec 4, 2018
@stale
Copy link

stale bot commented Feb 7, 2019

Is this still relevant? We haven't heard from anyone in a bit. If so, please comment with any updates or additional detail.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Don't take it personally, we just need to keep a handle on things. Thank you for your contributions!

@stale stale bot added the stale label Feb 7, 2019
@GuessWild
Copy link

+1 . Relevant for us

@stale
Copy link

stale bot commented Feb 7, 2019

Okay, it looks like this issue or feature request might still be important. We'll re-open it for now. Thank you for letting us know!

@stale stale bot removed the stale label Feb 7, 2019
@stale
Copy link

stale bot commented Apr 8, 2019

Is this still relevant? We haven't heard from anyone in a bit. If so, please comment with any updates or additional detail.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Don't take it personally, we just need to keep a handle on things. Thank you for your contributions!

@stale stale bot added the stale label Apr 8, 2019
@stale
Copy link

stale bot commented Apr 15, 2019

This issue has been automatically closed because it has not had recent activity. If you believe this is still an issue, please confirm that this issue is still happening in the most recent version of Snipe-IT and reply to this thread to re-open it.

@stale stale bot closed this as completed Apr 15, 2019
@kkuphal
Copy link

kkuphal commented Jun 19, 2019

Issue is still relevant. Encountered it today on a new SnipeIT docker installation

@paulpet
Copy link

paulpet commented Aug 5, 2019

I am running into this as well. Can we re-open the issue?

@kgortmak
Copy link

kgortmak commented Aug 7, 2019

Yep had the same experience on a new Snipe installation. This must be sorted as the software is not functioning as stated

@wookiesh
Copy link

same problem here also

@dannyhanes
Copy link

For those still having an issue, I had a similar issue and fixed it by editing /etc/php/7.2/apache2/php.ini and changing. Hopefully this helps someone.
upload_max_filesize = 2M to upload_max_filesize = 10M

@andremiller
Copy link

This is still an issue on the latest docker version.

/etc/php/7.1/apache2/php.ini has upload_max_filesize = 2M

@baditaflorin
Copy link

@snipe this problem is still present in the latest Docker Image.

Most users using the software from Mobile or Tablets cannot choose the file size of the photo that the camera will make. So this will become more problematic moving forward as newer cameras will generate bigger images by default.

For this use case's it would be useful to have a resize checkbox when uploading a photo.
[Upload image]
[x] resize to 1600px

@snipe
Copy link
Owner

snipe commented Nov 14, 2020

@baditaflorin the limitation is on the server end. We do resize image uploads, but there are PHP limitations on file uploads. We attempt to check what the server is configured to handle and disallow anything higher than that, since the server will reject the upload if it’s larger than that.

@baditaflorin
Copy link

baditaflorin commented Nov 14, 2020 via email

@uberbrady
Copy link
Collaborator

We can fix this in the Dockerfile itself without too much difficulty. I'll re-open this and put it on my plate.

@uberbrady uberbrady reopened this Nov 16, 2020
@stale
Copy link

stale bot commented Nov 16, 2020

Okay, it looks like this issue or feature request might still be important. We'll re-open it for now. Thank you for letting us know!

1 similar comment
@stale
Copy link

stale bot commented Nov 16, 2020

Okay, it looks like this issue or feature request might still be important. We'll re-open it for now. Thank you for letting us know!

@stale stale bot removed the stale label Nov 16, 2020
@dima-ser
Copy link

dima-ser commented Nov 19, 2020

Issue is still present in the latest docker image, please fix:

root@snipe-it:/var/www/html# grep "upload_max_filesize" /etc/php/7.2/apache2/php.ini
upload_max_filesize = 2M

@kmpc808
Copy link

kmpc808 commented Jun 3, 2021

@dannyhanes

"For those still having an issue, I had a similar issue and fixed it by editing /etc/php/7.2/apache2/php.ini and changing. Hopefully this helps someone.
upload_max_filesize = 2M to upload_max_filesize = 10M"

I am somewhat new. I found the correct path and used
"root@snipe-it:/var/www/html# grep "upload_max_filesize" /etc/php/7.2/apache2/php.ini"
as suggested above by @dima-ser to be sure.

What command do I need to use to change it from 2M to 10M?

Regards

@mtettke123 mtettke123 mentioned this issue Jun 3, 2021
2 tasks
@snipe
Copy link
Owner

snipe commented Jun 3, 2021

@uberbrady can you please address this when you're back from vacation? Thanks :)

@bwint
Copy link

bwint commented Jul 28, 2021

Having the same issue.
Based on the information here this line added to the dockerfile should fix the problem:
RUN sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 8M/' /etc/php/7.2/apache2/php.ini

@jcookatlas
Copy link

@dannyhanes

"For those still having an issue, I had a similar issue and fixed it by editing /etc/php/7.2/apache2/php.ini and changing. Hopefully this helps someone. upload_max_filesize = 2M to upload_max_filesize = 10M"

I am somewhat new. I found the correct path and used "root@snipe-it:/var/www/html# grep "upload_max_filesize" /etc/php/7.2/apache2/php.ini" as suggested above by @dima-ser to be sure.

What command do I need to use to change it from 2M to 10M?

Regards

@kmpc808
I'd strongly recommend that you manually edit the Apache2 php.ini file (the server configurations that @snipe mentioned on 14-NOV-2020)

You can use just about any file editor (I use NANO) from the cli as follows - I'm using php 7.4 your version may be different:

  1. sudo nano /etc/php/7.4/apache2/php.ini
  2. at line 694 (or there abouts) change the 'post_max_size' variable to your desired size limit
  3. at line 846 (or there abouts) change the 'upload_max_filesize' variable to your desired size limit
  4. save and exit via CTRL+X and Y to save modified buffers
  5. restart apache2 via: sudo systemctl restart apache2

I'm not 100% sure if a git-pull (the recommended update method) will over write these changes - I doubt it, but maybe @snipe or @uberbrady can comment for certainty. Otherwise, it's a pretty straight-forward and common change that is pretty easy to accomplish.

@uberbrady
Copy link
Collaborator

It’s definitely a good question - but, no, we do not overwrite php.ini values anywhere that I know of. And if we do, we should probably not.

@stepanov1975
Copy link

Can you please increase the upload size for the docker container?THanks!

@uberbrady
Copy link
Collaborator

I'd be happy to take a PR that made the above-mentioned change if it works.

@stepanov1975
Copy link

I'd be happy to take a PR that made the above-mentioned change if it works.
@uberbrady
Sorry. Not completely understood :) Do I need to open some requests?:)

@uberbrady
Copy link
Collaborator

If you can create a Pull Request (PR) with your proposed changes, I would be happy to accept (and merge) them.

@stepanov1975
Copy link

stepanov1975 commented Jan 25, 2022

@uberbrady I am not knowledgeable enough for PR
But I want to confirm that replacing upload_max_filesize = 2M to upload_max_filesize = 10M" in /etc/php/7.2/apache2/php.ini solves the problem
For whoever is interested you can do it simply by connecting to the container and running the command:
find /etc/php/*/apache2 -type f -name php.ini -exec sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 8M/' {} \;
This based on the proposal by @bwint but will work for any version of PHP

@kmpc808
Copy link

kmpc808 commented Jan 26, 2022

@stepanov1975 thank you for this! was jumping through hoops trying to figure this one out. really appreciate it.

@kmpc808
Copy link

kmpc808 commented Jan 26, 2022

@jcookatlas also thank you for the help as well!

@iwdinw2
Copy link

iwdinw2 commented Mar 7, 2022

@stepanov1975 thank you
using docker you can also just add "upload_max_filesize = 10M" to "/php/php-local.ini" and restart the container
this will override php.ini directives according to the comment in "/php/php-local.ini"

@SonGokussj4
Copy link

SonGokussj4 commented Aug 31, 2022

With ^this new way, a was able to increase upload limit limit to 8M. But I've set the number to 50M.

My steps:

  • Open snipeit asset, upload, select file bigger than 2MB, error
  • Open mounted /php/php-local.ini, add a new line upload_max_filesize = 50M, save the file, down docker, up docker
  • open snipeit asset, upload, select file 6 MB, everything works (but it shows 'upload size allowed is 8M'
  • select file 40 MB, upload, error - form timeout

I even tried to modify .env file to add (documentation)

# Docker-specific variables
PHP_UPLOAD_LIMIT=50

And even tried that to add as env value to docker-file:

services:
  snipeit:
    ...
    environment:
      - PHP_UPLOD_LIMIT=50

And still displaying only 8M

@uberbrady
Copy link
Collaborator

uberbrady commented Aug 31, 2022 via email

@SonGokussj4
Copy link

I'm sorry, that was a mistake I wrote here in my message. In reality, I wrote PHP_UPLOAD_LIMIT=50
Then I ran docker-compose down; docker-compose up -d

image

@SonGokussj4
Copy link

Okay, so I just noticed new Changelog resolved ISSUE for version 6.0.10 (I was on 6.0 9) for Docker not recognizing PHP upload limit.

So I've updated to 6.0.10 and... Still doesn't work. Still 8M.

I went into /php/php-local.ini and deleted the upload_max_filesize = 50M line.
Now it shows 2M again.

It's like it isn't reflecting my docker-compose setting (but other settings, like for the MAX_RESULTS, API_THROTTLE are working without a problem).

I've edited once again /php/php-local.ini with both:

upload_max_filesize = 50M
post_max_size = 50M

And now it works!
At least. But still ignoring setting in my Docker-Compose file ¯_(ツ)_/¯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests