Problem/Motivation

It would be useful if the maximum upload file size limit would be displayed on the content import page in the description of the file field, so users don't have to make guesses regarding the limit.

Steps to reproduce

Go to admin/content/import and see that there is no information regarding the maximum upload file size.

Proposed resolution

Display the maximum upload file size limit in the description of the file field.

CommentFileSizeAuthor
#10 after.png118.17 KBarunsahijpal
#10 before.png112.18 KBarunsahijpal
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

morvaim created an issue. See original summary.

nginex’s picture

Title: Daisplay the maximum upload file size limit » Display the maximum upload file size limit
Category: Bug report » Task
anish.ir’s picture

Assigned: Unassigned » anish.ir

nginex’s picture

Status: Active » Needs work

@anish.ir you don't need all this code you provided

Just one line is the way to go

format_size(Environment::getUploadMaxSize());
anish.ir’s picture

Okay, I'll do it.

anish.ir’s picture

Assigned: anish.ir » Unassigned

Hey @nginex,

I have tried implementing your suggestion but the funciton formatSize() is deprecated in Drupal 10.
I have also tried using : Bytes::toHumanString(Environment::getUploadMaxSize()) but it was also not working as expected to be.
Please have a look and let me know, whether I need to revert the changes or not.

nginex’s picture

Try

ByteSizeMarkup::create(Environment::getUploadMaxSize());

See https://www.drupal.org/node/2999981

anish.ir’s picture

Status: Needs work » Needs review

Hey @nginex,

Thank you for the reference, I have updated the MR. Please have a look.

arunsahijpal’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new112.18 KB
new118.17 KB

Good work @anish.ir,
I've tested the MR on my local and I assure that all the changes have been done and this is also working for Drupal 9.
Attaching ss for reference.
Hence moving it to RTBC.

Thanks,
Arun

nginex’s picture

Issue tags: +LutskGCW25

  • nginex committed 35d3e990 on 1.4.x authored by anish.ir
    Issue #3491624: Added the maximum file size to form.
    
nginex’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.