Want to set Limit for maximum file upload size

I want to set a upload file size in nextcloud web server which is rock linux, for that what are the configuration i need to do and what are the files that i need to configure, please give me an update regarding this.

Support intro

Sorry to hear you’re facing problems. :slightly_frowning_face:

The community help forum (help.nextcloud.com) is for home and non-enterprise users. Support is provided by other community members on a best effort / “as available” basis. All of those responding are volunteering their time to help you.

If you’re using Nextcloud in a business/critical setting, paid and SLA-based support services can be accessed via portal.nextcloud.com where Nextcloud engineers can help ensure your business keeps running smoothly.

Getting help

In order to help you as efficiently (and quickly!) as possible, please fill in as much of the below requested information as you can.

Before clicking submit: Please check if your query is already addressed via the following resources:

(Utilizing these existing resources is typically faster. It also helps reduce the load on our generous volunteers while elevating the signal to noise ratio of the forums otherwise arising from the same queries being posted repeatedly).

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can. :heart:

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • replace me
  • Operating system and version (e.g., Ubuntu 24.04):
    • replace me
  • Web server and version (e.g, Apache 2.4.25):
    • replace me
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • replace me
  • PHP version (e.g, 8.3):
    • replace me
  • Is this the first time you’ve seen this error? (Yes / No):
    • replace me
  • When did this problem seem to first start?
    • replace me
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • replace me
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • replace me

Summary of the issue you are facing:

[…]

Steps to replicate it (hint: details matter!):

Log entries

Nextcloud

Please provide the log entries from your Nextcloud log that are generated during the time of problem (via the Copy raw option from Administration settings->Logging screen or from your nextcloud.log located in your data directory). Feel free to use a pastebin/gist service if necessary.

PASTE HERE

Web Browser

If the problem is related to the Web interface, open your browser inspector Console and Network tabs while refreshing (reloading) and reproducing the problem. Provide any relevant output/errors here that appear.

PASTE

Web server / Reverse Proxy

The output of your Apache/nginx/system log in /var/log/____:

PASTE HERE

Configuration

Nextcloud

The output of occ config:list system or similar is best, but, if not possible, the contents of your config.php file from /path/to/nextcloud is fine (make sure to remove any identifiable information!):

PASTE HERE

Apps

The output of occ app:list (if possible).

Tips for increasing the likelihood of a response

  • Use the preformatted text formatting option in the editor for all log entries and configuration output.
  • If screenshots are useful, feel free to include them.
    • If possible, also include key error output in text form so it can be searched for.
  • Try to edit log output only minimally (if at all) so that it can be ran through analyzers / formatters by those trying to help you.

Hi @syed_asif
welcome to the community of Nextcloud :handshake:

You started a topic in support category. Unfortunately you ignored the template and a lot of information to help you is missing. Please edit your original post and add all required details like Nextcloud version, webserver type and version, os version, related log file content. Use the support template.

Without additional information the community members cannot help you.

You can setup it in php.ini

upload_max_filesize = 10M

Why do you want to set this up? It often makes more sense to simply set a quota per user.

1 Like

it sets only storage limit to a user and what i want to do was to set a limit for uploading file size

if i set upload_max_size = 1G
still more than 1G files are uploading even after restarting both services

I’d say that’s because Nextcoud uses chunking, meaning it splits files into multiple smaller pieces when uploading, and if those pieces are smaller than the upload_max_filsize, uploading larger files will still work.

So I would go with @devnull’s suggestion and set a quota per user. Let the users decide for themselves whether they prefer to have a few large files in their account or many smaller ones.

in my working env they need more storage, so i dont want to make quota and want max file upload for reducing the cpu usage

And you can’t just tell your users not to upload larger files, or use it strictly for work releated stuff? I mean either they need certain files on Nextcloud for their work or not, but yeah I guess we don’t need to argue about your reasoning… :wink:

I can only say that in order to achieve what you want in a reliable way and without unwanted side effects, it would most likely have to be done in Nextcloud itself, not in PHP or in the web server. Unfortunately, as far as I know, such a feature/configuration option is not implemented in Nextcloud, and I do not know how easy it would be to do so.

I did a bit of research…

You may be able to work around this problem by setting the chunksize in Nextcloud to the same or a higher value than the maximum file size you want to allow. The deafult is 100M: Configuration Parameters — Nextcloud latest Administration Manual latest documentation

However, I’m not sure this is a good idea, because if it works as I think it does, it would effectively disable chunking in your case, and with a maximum size of 1GB, which is still relatively large, the drawbacks may outweigh the benefits. Also, if you are uploading files over slow or unstable connections, such as mobile networks, a partial file upload cannot be resumed without chunking, and the entire file must be uploaded again.

I have not tested this, but the following may work:

In Nextcloud’s config.php:

'files.chunked_upload.max_size' => 1024 * 1024 * 1024, 

In the php.ini or Nextcloud’s .user.ini:

upload_max_filesize = 1G
post_max_size = 1G
1 Like

I’ve been working with computers since Bill Gates said that nobody needs more than 640 KB. I still think 1 GB is very big. In my environment, that would hardly be a size limit.

As a little extra idea:
If you want to control employees better, maybe you can give employees a small quota. You could also define group folders / team folders that are limited in size. This quota are not belongs to the user quota.

this is not the solution for my problem, what i asked was to set a upload limit for filesize, if you have any better idea regarding this, reply.

Yes, but @devnull has a point imho. If I understand correctly, your main problem is CPU load. And I’m honestly not sure if limiting the file size to 1G is actually the right way to solve your problem.

And yes, file chunking increases CPU load slightly, but only for files larger than 100MB.

So either your users need to regularly uploading large files to do their job, in which case it may make sense to increase the chunk size to a higher value, e.g to 200MB if the majority of files are between 100-200MB.

Or, your users are uploading large files all day that have nothing to do with their job, in which case you would have a problem that can’t or shouldn’t be solved with technology… :wink:

Either way, the point is that one should typically equip and tune a server to best serve the use cases of its users, not limit the possible use cases to the limits of the server, which may end up costing more money than buying a more powerful server. Always assuming it is serving the work that your users need to do. :wink:

This is not provided for in Nextcloud and is therefore done in phi.ini.