> For the complete documentation index, see [llms.txt](https://docs.sharinpix.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sharinpix.com/documentation/features/upload-images/upload-max-file-size.md).

# Upload Max File SIze

## Overview

In this article, we will demonstrate how to restrict the maximum size of a file when uploading on a SharinPix Album or SharinPix Single Image. To do so, we will:

* [Create a SharinPix Permission to set Max File Size](#creation-of-sharinpix-permission)
* [Assign the Permission to a SharinPix Component](#assign-the-sharinpix-permission-to-the-album-component)

{% hint style="warning" %}
**Prerequisite:**

**Before using this feature, ensure:**

* The SharinPix Package Version 1.340 (or later) is installed; refer to the article below to upgrade your current package: [*How to upgrade SharinPix package*](/faqs/how-to-update-sharinpix-package-from-the-appexchange.md)
  {% endhint %}

## Creation of SharinPix Permission

* In [SharinPix Permissions](/documentation/access-and-security/sharinpix-permission-object-how-to-create-and-assign-custom-permission.md), create a new record or edit an existing permission.
* Open the Upload section and set the maximum file size in **Megabytes**.

![](/files/hXd1V8MSObSkQD1sEB2y)

## Assign the SharinPix Permission to the Album component

* On a [SharinPix Album](/documentation/lightning-web-component/sharinpix-album-lwc.md), add the **ID** or **Name** of the SharinPix Permission record, which includes the maximum file size.
* In this example, the custom permission was named **Maximum File Size of 2MB**. It has been set in the **Custom Permissions Id or Name** parameter of a *SharinPix Album* component.

![](/files/Wj2SznZ4NSWiVhf8YOX8)

{% hint style="success" %}
**Tip:**

The above will also work for a [SharinPix Single Image](/documentation/lightning-web-component/sharinpix-single-image.md). The custom permission created should then be defined as a Single Image Permission.
{% endhint %}

## Demo

Now, the file will not be uploaded, and an alert will appear during upload if it exceeds the maximum file size set for the permission.

![](/files/o0pmzXhBq8HD0n4ABurn)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.sharinpix.com/documentation/features/upload-images/upload-max-file-size.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
