Provides an information about rejected file.

Namespace:  EasyAlgo.EAUpload
Assembly:  EasyAlgo.EAUpload (in EasyAlgo.EAUpload.dll)
Version: 1.3.0.0

Syntax

C#
public class RejectedFile
Visual Basic (Declaration)
Public Class RejectedFile

Remarks

Instance of this class is created when transmitted file has an extention that is defined in AllowedFileExtentions parameter of EAUpload configuration or when ProcessRequestOnError is specified as true and an exception occures during upload. EAUpload processes the file and provides only part of file properties such as file name, file size and content type. The bynary content of the file are not saved on a server.

You cannot create an instance of this class with the new keyword. You can obtain it by referencing an item within the Upload..::.RejectedFiles collection of an EasyAlgo.EAUpload..::.Upload object.

Examples

The following example demonstrates how to retrieve the RejectedFile object from RejectedFileCollection.
CopyC#
// 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>
...
CopyVB.NET
// 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>
...

Inheritance Hierarchy

System..::.Object
  EasyAlgo.EAUpload..::.RejectedFile

See Also