ElkArte Community

Elk Development => Bug Reports => Topic started by: Jorin on October 26, 2018, 08:50:14 am

Title: maximum attachment size
Post by: Jorin on October 26, 2018, 08:50:14 am
I have set the maximum size of attachments to 30.720 KB for the summary all attachments and 10.240 KB for each attachment in the admin center.

When I post a message, the editor says I can attach a file with a maximum size of 204.800 KB and all attachments can have the same size in summary.

It seems the admin settings work, I can't upload a larger file then 10 MB. But what's wrong with the editor?
Title: Re: maximum attachment size
Post by: radu81 on October 26, 2018, 01:11:12 pm
Are you using the Resize attachments add-on? If so and iirc that size you are seeing is setup by you host limits.
Title: Re: maximum attachment size
Post by: emanuele on October 26, 2018, 03:48:35 pm
Could be some math or conversion between php and js.
I have to turn on the admin account and see here what are the limits.
Title: Re: maximum attachment size
Post by: radu81 on October 26, 2018, 04:41:57 pm
Quote from: Spuds – ... when you go to reply, what does it say in the attachment area, there should be a line like .... (Restrictions: 20 per post, maximum total size 8,192 KB, maximum individual size 4,096 KB) The size values should be your server max limits (as determined by the addon), not the limits set in the admin panel.  If the addon is off then it would show the admin panel limits.
and
Quote from: Spuds – What values are in your phpinfo() ( can use admin-> main -> support and credits and select more detailed next to php info for:

upload_max_filesize
post_max_size


 
Title: Re: maximum attachment size
Post by: Jorin on October 30, 2018, 03:10:23 am
Thanks, radu. Both says 200 MB as maximum. So that's where the editor gets this from.

But why does he shows 200 MB as maximum when the admin panel is set to 30 MB max?
Title: Re: maximum attachment size
Post by: radu81 on October 30, 2018, 03:17:17 am
When you install the Resize Attachments add-on the settings you set in admin panel are ignored using your host limits. It'snot a bug, it's just how this add-on works. I get 1GB limits
Title: Re: maximum attachment size
Post by: Jorin on October 30, 2018, 06:59:05 am
Hm... But I can attach PDFs which cannot be resized. So my users think they can attach 200 MB PDF files, but they can't.  :-X
Title: Re: maximum attachment size
Post by: badmonkey on October 30, 2018, 07:28:23 am
Quote from: radu81 – When you install the Resize Attachments add-on the settings you set in admin panel are ignored using your host limits. It'snot a bug, it's just how this add-on works. I get 1GB limits
 
 Doesn't work that way on any of mine. The limit is the lesser of ACP settings or php.ini.
Title: Re: maximum attachment size
Post by: radu81 on October 30, 2018, 09:56:17 am
@badmonkey‍ see the reply 3 in this topic from Spuds.

Here is what I have in Elk ACP
Code: [Select]
Max attachment size per post: 9600 KB
Max size per attachment: 5000 KB
Max number of attachments per post: 15

Here are my PHP settings:
Code: [Select]
upload_max_filesize 512M
post_max_size 1024M


And this is the result I get in Elkarte under post reply
Code: [Select]
 Restrictions: 15 per post, maximum total size 1,048,576 KB, maximum individual size 524,288 KB
Title: Re: maximum attachment size
Post by: badmonkey on October 30, 2018, 01:25:25 pm
Huh. Somehow that has escaped comprehension. Good info. That being the case, it may be a good idea to spell it out for us dummies.   :D
Title: Re: maximum attachment size
Post by: radu81 on October 30, 2018, 02:10:36 pm
I agree, it's not very clear, I discovered that info from Spuds. 
Title: Re: maximum attachment size
Post by: emanuele on November 01, 2018, 12:53:41 pm
Then you have to summon @Spuds and blame him! :P
Title: Re: maximum attachment size
Post by: badmonkey on November 01, 2018, 04:42:53 pm
Quote from: emanuele – Then you have to summon @Spuds and blame him! :P
 
 It isn't Spuds fault we're dummies.  :D
Title: Re: maximum attachment size
Post by: Spuds on November 01, 2018, 09:23:59 pm
I can see how all that can be confusing ... especially when dealing with non image files which will be rejected for size even though they are under the limits given by the form.

I think ideally the line would read one size (that max size per PHP limits) for images and another size per the ACP (for non image files).

The addon has to initiate the post attachment form with the PHP limits so teh client will allow the user to upload a file of that max allowable size.  If I leave the values as set in the ACP the form / browser / http would refuse to send the file.   

The ACP limits are still enforced on the server side, this allows the form to send a larger file and gives the server an opportunity to compress it to fit within those ACP limits.  That compression only works for images so large files,  like PDF's get rejected server side (instead of client side) which can create a WTF moment for the user as the form limit says its fine.

The cleanest thing may be to allow limits to be set independently for image files and non-image file size limits, but that would take rework of the attachment JS and is a beyond what the addon can (or should) do.  This is maybe something for 2.0, and in the meantime I could check if I can add more clear text to that limit line on the form.
Title: Re: maximum attachment size
Post by: ahrasis on March 27, 2019, 09:49:29 am
I don't think this one is tracked yet for 2.0.