# 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*](https://app.gitbook.com/s/i8tH1o5AHthxksYgF6ij/how-to-update-sharinpix-package-from-the-appexchange)
  {% endhint %}

## Creation of SharinPix Permission

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

![](https://2221230591-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5EvYRrLbUyvRh8o1jmMG%2Fuploads%2Fgit-blob-38e263b9ac3eaffa811b44d0767a57c6b3146895%2FDOC%20SF%20-%201920%20x%20600\(1\).png?alt=media)

## Assign the SharinPix Permission to the Album component

* On a [SharinPix Album](https://docs.sharinpix.com/documentation/lightning-web-component/sharinpix-album-lwc), 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.

![](https://2221230591-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5EvYRrLbUyvRh8o1jmMG%2Fuploads%2Fgit-blob-2daf5b64d9ce62517b856e655635e4888f76b0c0%2FDOC%20SF%20-%201920%20x%20360%20\(4\).png?alt=media)

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

The above will also work for a [SharinPix Single Image](https://docs.sharinpix.com/documentation/lightning-web-component/sharinpix-single-image). 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.

![](https://2221230591-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5EvYRrLbUyvRh8o1jmMG%2Fuploads%2Fgit-blob-29d03acc6fd8300fc4cd36bbaccc7057b9f67175%2FDOC%20SF%20-%201920%20x%201080\(2\)%20\(1\).png?alt=media)
