DEXTUpload.NET
Class FileUpload
- The minimum supported version
- 5.0.0.0
- The minimum support environment
- .NET Framework 4.0
- Explanation
-
Multipart request that has been transferred from the client is analyzed in "DEXTUpload.NET.FileUploadMonitorModule" HTTP module. Collection objects that are generated from the multipart data is handled by the Web page or handler, the object of the "FileUpload" class is created by getting the "DEXTUpload.NET.MultipartCollection" object as a parameter, it is responsible to end up the processing uploading files. The "FileUpload" class does not have the ability to transfer files, it has a role to save received files to a final destination.
Note) The "FileUpload" class, because it does not analyze the multi-part data, is not able to handle the entire process of uploading files on its own without the "DEXTUpload.NET.FileUploadMonitorModule" HTTP module.
using (var dext = new FileUpload()) { // Save all uploaded files. dext.SaveAll(); }
- Type
-
public class FileUpload : IDisposable
- Constructors
-
FileUpload
-
Does initialization when creating an instance of the "FileUpload" class.
-
Type
public FileUpload()
-
- Properties
-
IsDisposed
-
Gets whether the resources managed by the object was released.
If the value of this property is "true", it means that the "FileUpload" object is in a state that can not be used anymore.
-
Type
public bool IsDisposed { get; }
Environment
-
Gets the "DEXTUpload.NET.DXTEnvironment" object contains a variety of settings of the component.
-
Type
public DXTEnvironment Environment { get; }
TempPath
-
Gets the path of the directory to temporarily save the file.
By default, it matches the value of TempRepository property of the "DEXTUpload.NET.DXTEnvironment" object.
-
Type
public string TempPath { get; }
DefaultPath
-
Gets or sets the location of the default directory to save the file.
By default, it matches the value of "DefaultRepository" property of the "DEXTUpload.NET.DXTEnvironment" object.
-
Type
public string DefaultPath { get; set; }
Collection
-
Gets the "DEXTUpload.NET.MultipartCollection" object.
The "DEXTUpload.NET.MultipartCollection" class is a collection that has been created so that it can be processed by classifying the requested data to a string and file.
-
Type
public MultipartCollection Collection { get; }
WillRemoveWhenClosing
-
Gets or sets whether you want to delete the remaining temporary files when calling the "Dispose" method of the "FileUpload" object for releasing the resources.
Because the default is "true", when calling the "Dispose" method, the temporary files will be removed.
-
Type
public bool WillRemoveWhenClosing { get; set; }
StringCount
-
Gets the number of form elements of the string in a multi-part request.
-
Type
public int StringCount { get; }
FileCount
-
Gets the number of form elements of the file in a multi-part request.
-
Type
public int FileCount { get; }
-
- Methods
-
ContainsKey
- Returns whether or not there is a form element with the specified name(key).
-
Type
public bool ContainsKey(string key)
-
Parameters
Name Type Explanation key System.String The name(key) of the form. -
Return
If it exists, it is "true", otherwise, "false".
ContainsStringKey
- Returns whether or not there is the string form element with the specified name(key).
-
Type
public bool ContainsStringKey(string key)
-
Parameters
Name Type Explanation key System.String The name(key) of the form. -
Return
If it exists, it is "true", otherwise, "false".
ContainsFileKey
- Returns whether or not there is the file form element with the specified name(key).
-
Type
public bool ContainsFileKey(string key)
-
Parameters
Name Type Explanation key System.String The name(key) of the form -
Return
If it exists, it is "true", otherwise, "false".
GetStringElement
-
Returns the "DEXTUpload.NET.StringElement" object corresponding to the specified index or name(key).
-
Type
public StringElement GetStringElement(int index) public StringElement GetStringElement(string key)
-
Parameters
Name Type Explanation index System.Int32 The zero-based index. key System.String The name(key). -
Return
The "DEXTUpload.NET.StringElement's" object corresponding to the specified index or name(key).
If the parameter is the name(key), it returns the first object corresponding to the name.
GetStringElements
-
Returns the "DEXTUpload.NET.StringElementList" list object corresponding to the specified index or name(key).
-
Type
public DEXTUpload.NET.StringElementList GetStringElements(string key)
-
Parameters
Name Type Explanation key System.String The name(key). -
Return
The "DEXTUpload.NET.StringElementList" list object corresponding to the specified index or name(key).
GetString
-
Returns a string value corresponding to the specified index or name(key).
-
Type
public StringElement GetString(int index) public StringElement GetString(string key)
-
Parameters
Name Type Explanation index System.Int32 The zero-based index. key System.String The name(key). -
Return
A string corresponding to the specified index or name(key).
In the case of the parameter is a name(key), it returns the first string corresponding to the name.
GetFileElement
-
Returns the "DEXTUpload.NET.FileElement" object corresponding to the specified index or name(key).
-
Type
public FileElement GetFileElement(int index) public FileElement GetFileElement(string key)
-
Parameters
Name Type Explanation index System.Int32 The zero-based index. key System.String The name(key). -
Return
The "DEXTUpload.NET.FileElement" object corresponding to the specified index or name.
If the parameter is a name, it returns the first object that corresponds to the name.
GetFileElements
-
Returns the "DEXTUpload.NET.FileElementList" list object corresponding to the specified name(key).
-
Type
public DEXTUpload.NET.FileElementList GetFileElement(string key)
-
Parameters
Name Type Explanation key System.String The name(key). -
Return
Returns the "DEXTUpload.NET.FileElementList" object corresponding to the specified name(key).
GetFirstFileElement
-
Returns the first "DEXTUpload.NET.FileElement" object.
-
Type
public DEXTUpload.NET.FileElement GetFirstFileElement()
-
Return
The first "DEXTUpload.NET.FileElement" object.
GetLastFileElement
-
Returns the last "DEXTUpload.NET.FileElement" object.
-
Type
public DEXTUpload.NET.FileElement GetLastFileElement()
-
Return
The last "DEXTUpload.NET.FileElement" object.
GetSingleFileElement
-
Returns one of the "DEXTUpload.NET.FileElement" object.
The method is used when you want to upload only one file.
-
Type
public DEXTUpload.NET.FileElement GetSingleFileElement()
-
Return
The "DEXTUpload.NET.FileElement" object.
Close
-
To release the resources used by the object.
To perform the same function as the "Dispose" method.
-
Type
public void Close()
Dispose
-
Releases the resources used by the "FileUpload" object.
If the "WillRemoveWhenClosing" property is "false", it won't delete temporary files.
-
Type
public void Dispose() protected virtual void Dispose(bool explicitDisposing)
-
Parameters
Name Type Explanation explicitDisposing System.Boolean If resources explicitly have been released, it is "true" or "false".
SaveAll
-
Save all files.
Empty items or items filtered are not saved.
Note) The file of 0 bytes will be saved.
-
Type
public IEnumerable<FileElement> SaveAll() public IEnumerable<FileElement> SaveAll(string directoryPath) public IEnumerable<FileElement> SaveAll(DirectoryInfo directory) public IEnumerable<FileElement> SaveAll(FileSaveOption option) public IEnumerable<FileElement> SaveAll(string directoryPath, FileSaveOption option) public IEnumerable<FileElement> SaveAll(DirectoryInfo directory, FileSaveOption option)
-
Parameters
Name Type Explanation directoryPath System.String The path(the sub-path of the Web applications or the path on the local operating system) of the directory where temporary files will be saved. directory System.IO.DirectoryInfo An object with the path information of the directory where temporary files will be saved. option DEXTUpload.NET.FileSaveOption An setting object when saving files. -
Return
Returns the "System.Collection.Generic.IEnumerable<FileElement>" object that contains the list of saved.