1

How to restrict uploading image based on its file size and image resolution in the custom image library using the "Validation Settings" feature available OOB.

Resolution restricts with =AND([Picture Height]>50,[Picture Width]>50) but not working.

2

First, the file size is not a supported field in the validation settings.

Check also, THE SUPPORTED AND UNSUPPORTED COLUMNS IN SHAREPOINT CALCULATED COLUMN FORMULA AND LIST VALIDATION SETTINGS.

Note: The maximum file size you can upload to a SharePoint Online site is 15 GB per file. unfortunately, you can't modify this limit as we can do in SharePoint On-Prem because it's a shared setting for all the tenants. also, there are no OOTB settings to adjust the file size limit per document library.

Workaround

Create a remote event receiver on item Adding to check the file size before upload.


Second, The Picture Height & Width are supported in the validation settings.

BUT, you should be aware of the validation doesn't fire on item upload, it's fired on item save / check-in.

So your formula =AND([Picture Height]>50,[Picture Width]>50) should work but not as expected, where the file should be first uploaded, then the validation will be executed when you hit SAVE or CHECK-IN button as shown below:

enter image description here

I think this should be also helpful because you will not be able to save or check-in your files until matching the correct dimensions. in this case, you will be forced to upload a file again to match the validation settings.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.