Gets the RejectedFile object with the specified name from the files collection.
Namespace:
EasyAlgo.EAUploadAssembly: EasyAlgo.EAUpload (in EasyAlgo.EAUpload.dll)
Version: 1.3.0.0
Syntax
| C# |
|---|
public RejectedFile this[ string fieldName ] { get; } |
| Visual Basic (Declaration) |
|---|
Public ReadOnly Default Property Item ( _ fieldName As String _ ) As RejectedFile |
Parameters
- fieldName
- Type: System..::.String
The value of "name" attribute of an INPUT element which the rejected file is associated.
Field Value
Type: EasyAlgo.EAUpload..::.RejectedFileThe RejectedFile object.
Remarks
This property returns nullNothingnullptra null reference (Nothing in Visual Basic) if the specified key is not found.
Examples
The following example demonstrates how to retrieve the RejectedFile object by the form field name.
CopyC#
CopyVB.NET
// fileupload.aspx.cs ... Upload _CurrentUpload = UploadsManager.GetUpload(); RejectedFileCollection _RejectedFiles = _CurrentUpload.RejectedFiles; if (_RejectedFiles.Count != 0) { RejectedFile _File = _RejectedFiles["File1"]; string _FileName = _File.ClientFileName; // displaying a warning lblResponse.Text = HttpUtility.HtmlEncode(_FileName) + " had been rejected. <br/>"; lblResponse.Text += "Only jpeg files is allowed for upload."; } ... ____________________________ // fileupload.aspx ... <form id="Form1" method="post" runat="server"> ... <input type="file" name="File1" id="File1"> <asp:Label id="lblResponse" runat="server"></asp:Label> ... </form> ...
' fileupload.aspx.vb ... Dim _CurrentUpload As Upload = UploadsManager.GetUpload Dim _RejectedFiles As RejectedFileCollection = _CurrentUpload.RejectedFiles If _RejectedFiles.Count <> 0 Then Dim _File As RejectedFile = _RejectedFiles("File1") Dim _FileName As String = _File.ClientFileName 'displaying a warning lblResponse.Text = HttpUtility.HtmlEncode(_FileName) & " had been rejected. <br/>" lblResponse.Text &= "Only jpeg files is allowed for upload." End If ... ____________________________ ' fileupload.aspx ... <form id="Form1" method="post" runat="server"> ... <input type="file" name="File1" id="File1"> ... </form> ...
