views:

169

answers:

1

How to restrict user to attach particular type of files to items in a list ? Now i can attach any type of file to an item . But i want to restrict the user to upload only images. If user will upload any other then i want to display an error message . Also how can i restrict the user to upload maximum one file only to a particular item?

+1  A: 

The best way forward really is to create an event receiver and iterate through the item's Attachments property to see what has been uploaded.

In SharePoint 2007 you can only return simple error messages. In SharePoint 2010 this has been much improved.

If you don't want to create a new Visual Studio project then you can also consider a Sharepoint Designer workflow to achieve the same. Check out this article which shows how to do some basic validation when a file has been uploaded.

Muhimbi