FileMove (Dundas Upload Control 2.0)
Overview | Properties | Methods
Call this method to move a file from one location to another.
Syntax
UploadObject.FileMove(Source As String, Destination As String[, FailIfExsists As Boolean = TRUE])
The FileMove method syntax has the following parts:
Part |
Description |
Source |
Name of the file to be moved. Use either a relative or absolute pathname, depending on the setting of the UseVirtualDir property. |
Destination |
Destination location. Use either a relative or absolute pathname, depending on the setting of the UseVirtualDir property. |
FailIfExists |
If TRUE an exception will be thrown if the file already exists at the specified destination. If this is FALSE then an existing file with the same name will be overwritten. Defaults to TRUE. |
Remarks
An exception is thrown if the operation fails. Trap for success/failure by examining VBScript's Err object immediately after calling this method (the Number property of the Err object will be a non-zero value if it failed). MAKE SURE that you have enabled inline error trapping by using an On Error Resume Next statement at the beginning of the ASP page.
This method can be used to rename a file by specifying the same directory path with differing filenames for the Source and Destination arguments.
If UseVirtualDir is set to TRUE then the specified path needs to be relative. It should start with a forward slash and be followed by a valid alias, and any sub-folders need to be separated with forward slashes. If you specify a physical pathname when UseVirtualDir is TRUE an exception will be thrown.
If the default user account does not have the appropriate permission to perform this action then an "Access Denied" error will occur. You can use the ImpersonateUser method to temporarily assume another user account which has the appropriate permission, perform the operation and then call ImpersonationTerminate to resume using the default account.
See Also: FileCopy | FileExists | FileDelete