R – How to control file uploads in a SharePoint Picture Library

sharepoint

How can I restrict file upload type and size for a WSS 3.0 Picture Library?

I know I can restrict file upload size for an entire SharePoint web application via Central Admin / Application Management / Web Application General Settings. I can also block file types for the web application on the Central Admin / Operations / Blocked File Types pages. But those settings are for the entire application. I want want to only allow up to 1MB image file types in my Picture Library, but allow larger document in other libraries. Is this possible?

Best Solution

create an SPItemEventReceiver feature that uses the ItemAdding event to cancel the upload if it is larger then 1 MB. You will have to cast the ListItem to a document to get the size if I recall correctly. Use the EventReciever manager from codeplex http://speventhandlermanage.codeplex.com/ to hook your event handler up to the right list or use a feature to attach it all lists that have the Image content type.

Related Question