DEXTUpload.NET Professional
menu toggleReferences > DEXTUpload.NET.Mvc > DEXTPostedFile

DEXTUpload.NET.Mvc
Class DEXTPostedFile

The minimum supported version
5.0.0.0
The minimum support environment
.NET Framework 4.0
Explanation

The "System.Web.HttpPostedFileBase" class plays a fundamental role to provide access to individual files that the client has uploaded.

In ASP.NET MVC, it is possible to access uploaded files using the "System.Web.HttpPostedFileWrapper" was derived from the "HttpPostedFileBase" class, the "HttpPostedFileWrapper" class is internally wrapping the "System.Web.HttpPostedFile" class.

The "DEXTPostedFile" class is derived from the "HttpPostedFileBase" class such as the "HttpPostedFileWrapper" class. However, unlike the "HttpPostedFileWrapper" class, it does not wrap the "HttpPostedFile" class, internally delegates the "DEXTUpload.NET.FileElement" class.

To use the DEXTUpload.NET Professional product in ASP.NET MVC environment, it is necessary to use the parameter of the "DEXTPostedFile" class without using the parameters of "HttpPostedFileBase" class in the controller's action method.

[HttpPost]
public ActionResult Upload([Bind(Prefix = "file1")] DEXTPostedFile file)
{
    // If empty file, the "file" parameter will be "null".
    if (file != null)
    {
        file.Element.Save();
    }
    ...
}
Type
public class DEXTPostedFile : HttpPostedFileBase
Constructors

DEXTPostedFile

  • Does initialization when creating an instance of the "DEXTPostedFile" class.

  • Type

    public DEXTPostedFile(FileElement element)
  • Parameters

    Name Type Explanation
    element DEXTUpload.NET.FileElement An object that has the information of the temporary file.
Properties

Element

  • Gets the "DEXTUpload.NET.FileElement" object that has the information of the temporary file.

  • Type

    public FileElement Element { get; }

FileName

  • Gets the name of the file, except its folder path.

  • Type

    public override string FileName { get; }

ContentLength

  • Gets the size(byte) of the file.

    The type of the value is "System.Int32", if the size is more than 2GB, it is difficult to obtain the correct value.

    To get the precise size of the file is to use the "Element.FileLength" property.

  • Type

    public override int ContentLength { get; }

ContentType

  • Gets the value of the "Content-Type" field in each form element of the multi-part data.

    Because this value was analyzed and transmitted by the client on its own way, it can be a wrong value. Therefore, the "ContentType" should be used only for reference.

  • Type

    public override string ContentType { get; }

InputStream

  • Gets the "System.IO.Stream" object to read the contents of the uploaded file.

  • Type

    public override Stream InputStream { get; }