snipe / snipe-it

A free open source IT asset/license management system
https://snipeitapp.com
GNU Affero General Public License v3.0
11.21k stars 3.2k forks source link

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

Closed tmvillain13 closed 3 years ago

tmvillain13 commented 6 years ago

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):

Desktop (please complete the following information):

Smartphone (please complete the following information):

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

EarlRamirez commented 6 years ago

Are there any file size restrictions on your web server?

tmvillain13 commented 6 years ago

No, it is my own NAS

tmvillain13 commented 6 years ago

@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 commented 6 years ago

@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[bot] commented 6 years ago

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!

tmvillain13 commented 6 years ago

UP

stale[bot] commented 6 years ago

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[bot] commented 5 years ago

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!

GuessWild commented 5 years ago

+1 . Relevant for us

stale[bot] commented 5 years ago

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[bot] commented 5 years ago

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[bot] commented 5 years ago

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.

kkuphal commented 5 years ago

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

paulpet commented 5 years ago

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

kgortmak commented 5 years ago

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

wookiesh commented 5 years ago

same problem here also

dannyhanes commented 4 years ago

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 commented 4 years ago

This is still an issue on the latest docker version.

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

baditaflorin commented 4 years ago

@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 commented 4 years ago

@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 commented 4 years ago

I am using the Docker container. It would be useful if we could set this when starting the container

On Sat, Nov 14, 2020, 23:19 snipe notifications@github.com wrote:

@baditaflorin https://github.com/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.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/snipe/snipe-it/issues/6251#issuecomment-727266845, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARZC52QDPARXAXWZS6R233SP3X6TANCNFSM4FXW775A .

uberbrady commented 4 years ago

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

stale[bot] commented 4 years ago

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[bot] commented 4 years ago

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!

dima-ser commented 4 years ago

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 commented 3 years ago

@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

snipe commented 3 years ago

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

bwint commented 3 years ago

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 commented 3 years ago

@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 commented 3 years ago

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 commented 2 years ago

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

uberbrady commented 2 years ago

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

stepanov1975 commented 2 years ago

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 commented 2 years ago

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

stepanov1975 commented 2 years ago

@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 commented 2 years ago

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

kmpc808 commented 2 years ago

@jcookatlas also thank you for the help as well!

iwdinw2 commented 2 years ago

@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 commented 2 years ago

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

My steps:

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 commented 2 years ago

if you typo'ed the upload limit - as PHP_UPLOD_LIMIT - then it won't work.

But when I change that environment variable, it does change the maximum upload size for me.

On Wed, Aug 31, 2022 at 4:05 AM SonGokussj4 @.***> wrote:

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

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

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

SonGokussj4 commented 2 years ago

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 commented 2 years ago

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 ¯_(ツ)_/¯