Skip to content

[FileType]

IntelliTect.Coalesce.DataAnnotations.FileTypeAttribute

Specify the allowed file types for a file method parameter. The value is passed through to the "accept" attribute of an HTML File Input. This does not implement any server-side validation of file content.

Example Usage

c#
public class Person
{
    public int PersonId { get; set; }

    public async Task UploadProfilePicture([FileType("image/*")] IFile file) 
    {

    }
}

Properties

// Also settable via constructor parameter #1
public string FileTypes { get; set; }

Comma-delimited list of Unique file type specifiers.

Examples:

  • "image/*" - Common image formats
  • .pdf,application/pdf - PDF Files
  • .doc,.docx,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document - Microsoft Word Documents

Coalesce is a free and open-source framework created by IntelliTect to fill our desire to create better apps, faster. IntelliTect is a high-end software architecture and development consulting firm based in Spokane, Washington.

If you're looking for help with your software project, whether it be a Coalesce application, other technologies, or even just an idea, reach out to us at info@intellitect.com — we'd love to start a conversation! Our clients range from Fortune 100 companies to local small businesses and non-profits.