Adds a file to the specified folder.
Namespace: DotNetNuke.Services.FileSystemAssembly: DotNetNuke (in DotNetNuke.dll)
Syntax
C# |
---|
public virtual IFileInfo AddFile( IFolderInfo folder, string fileName, Stream fileContent, bool overwrite, bool checkPermissions, string contentType, int createdByUserID ) |
Visual Basic |
---|
Public Overridable Function AddFile ( folder As IFolderInfo, fileName As String, fileContent As Stream, overwrite As Boolean, checkPermissions As Boolean, contentType As String, createdByUserID As Integer ) As IFileInfo |
Parameters
- folder
- Type: DotNetNuke.Services.FileSystem..::..IFolderInfo
The folder where to add the file.
- fileName
- Type: System..::..String
The name of the file.
- fileContent
- Type: System.IO..::..Stream
The content of the file.
- overwrite
- Type: System..::..Boolean
Indicates if the file has to be over-written if it exists.
- checkPermissions
- Type: System..::..Boolean
Indicates if permissions have to be met.
- contentType
- Type: System..::..String
The content type of the file.
- createdByUserID
- Type: System..::..Int32
ID of the user that creates the file
Return Value
A IFileInfo as specified by the parameters.Implements
IFileManager..::..AddFile(IFolderInfo, String, Stream, Boolean, Boolean, String, Int32)
Exceptions
Exception | Condition |
---|---|
System..::..ArgumentNullException | Thrown when folder, fileName or fileContent are null. |
DotNetNuke.Services.FileSystem..::..FolderProviderException | Thrown when the underlying system throw an exception. |
DotNetNuke.Services.FileSystem..::..InvalidFileExtensionException | Thrown when the extension of the specified file is not allowed. |
DotNetNuke.Services.FileSystem..::..NoSpaceAvailableException | Thrown when the portal has no space available to store the specified file. |
DotNetNuke.Services.FileSystem..::..PermissionsNotMetException | Thrown when permissions are not met. |