asp.net.ph

HtmlInputFile.Accept Property

System.Web.UI.HtmlControls Namespace   HtmlInputFile Class


Sets or retrieves a comma-separated list of MIME encodings used to constrain the file types the user can select.

Syntax


Inline <input type=file accept = strEncoding ... >
Script HtmlInputFile.Accept [ = strEncoding ]

Property Value


strEncoding String specifying a comma-separated list of MIME type encodings.

The property is read/write with no default value.

Remarks

Use this property to specify the file types that can be uploaded to the server. For example, to restrict the selection to images, set this property to image/*.

NOTE: Support for this property is browser dependent, and may not work for all browsers.

Example

The below code shows how to declaratively set the Accept property to restrict the user from selecting any file other than an image file.

<input type="file" id="myFileUploader" accept="image/*" runat="server"/>

 Show me 

See Also

HtmlInputFile Members Skip Navigation Links




Previous page Back to top Next page

Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note