Current Version:
1.01.2
Last Update: 01-27-2003
Contents:
Date Version Description 4-22-2003 1.01.3
- Changed several compile options that should not effect the performance or funcationality of the component. These compile options were turned on based on the following MSDN articles:
http://support.microsoft.com/support/kb/articles/q264/9/57.asp
http://support.microsoft.com/support/kb/articles/q241/8/96.asp1-27-2003 1.01.2
- Made a small update to the PrintClient method
9-6-2002 1.01.1
- Added the PrintClient method
- Added the DownloadFileToClient method
- Changed the way that the HTTP component responds to the open connection method. You now need to get the contents that were returned in the Contents properties
- Added the Headers collection to the HTTP component.
8-14-2002 1.00.2
- Updated the GetFile method so it does not cache retrieved files.
- Added the GetLastResponse method that can be used to get the last response that the FTP server return on the standard FTP port.
- Added the ExecuteCommand method. This method can be use to execute custom FTP commands.
8-5-2002 1.00.1
- Revised the putfile method so it now accepts a path for the remote path folder. Before it returned an error if a path was passed and the directory property needed to be used to change the directory where the file should be placed.
- Updated the GetDirectoryListing and Files methods so they will no longer cache directory information.
- Updated the trial and full versions so they were synchronized with one another.
7-23-2002 1.00.0
- Beta testing for Majodio.FTP is officially complete. Thanks to all of the people out there who helped build and test this component.
7-22-2002 0.88.3b
- Fixed a bug with the Files() method. It was failing to return a collection if there were no files in the current directory. Thanks go out to dimitris for pointing out this error.
7-12-2002 0.88.2b
- Fixed a bug that made all files retrieved using the GetFile method read-only on the local file system.
- Added two new methods GetDirectory and PutDirectory. Each will either get a directory from the remote server or Put a directory from the local server respectively. Please see the documentation for more detail.
6-19-2002 0.88b
- This version is a complete rewrite from the previous version (0.87b)
- GetDirectoryListing now has a new an improved counterpart, Files. This method returns a collection that contains all of the files/directories and attributes of those files/directories within the current directory.
- Return values for many of the function have been removed. The True/False values that were returned before to indicate success or failure have been replaced with true errors that are raised when an error occurs.
- Added an HTTP object to the component that will allow a developer to download a web page from the Internet in his/her webpage.
5-12-2002 0.87b
- Changed call to WinInet API parameter port to be a long as opposed to an integer. Now the component will accept values larger than 32767 in this field.
4-13-2002 0.86b
- Updated variables throughout code to be variants as opposed to strictly strings. This will erase the need for ASP developers to put a CStr function around variables that are passed into the routine,
- Fixed GetFile method so the overwrite parameter works correctly. Now when you set it to true it will overwrite a file on the local file system as opposed to having to set it to false before.
Majodio Software is a software development company that develops solutions for ASP related problems. Thank you for using our software.
The software source code for Majodio ASP Components are available for purchase. Please send an email to support@majodio.com for more information regarding source code.
Installing Majodio FTP is very simple. This version does not include an automatic installation script, but you'll find everything you need here!
- First unzip the archive that you downloaded from the Internet. It is probably safe to assume that you have accomplished this if you are reading this document.
- Second move the majodio.dll file to a directory of your choosing. We recommend "C:\WINNT\system32\inetsrv\asp components", but this is just a recommendation. You can put the file on your desktop if you like (but don't delete it if you do!)
- Next, open a DOS windows and navigate to the directory that you put the file in.
- Lastly, type the following command:
Regsvr32 majodio.dll
After you press enter, a message box will pop up to let you know that the control was successfully installed.If you have any trouble with these steps, please visit http://www.majodio.com/forum. We will do our best to help you with your problems.
Thanks again for using our component.
Support for Majodio software is provided (in a limited setting) at http://www.majodio.com/forum. If you need additional support for your Majodio products you may visit our premium support center for a small fee. Please send an email to support@majodio.com for more information regarding premium support.
Question: Can I use this component with Windows Scripting Host (WSH)? Answer: I have no experience with this language, but users have reported that the component should work with WSH.
The OpenConnection method of this component will fail randomly once every ten object instantiation. To get a version that will not fail, please go to www.majodio.com to register the component.
In order to instantiate a copy of the component, use the ASP command Server.CreateObject("Majodio.FTP").
Example:
set myftp = Server.CreateObject("Majodio.FTP")Properties
URL
Type: String Default Value: None Notes: The URL/IP address of the machine that you are attempting to connect to. Example: ftp.URL = "111.111.111.111" or ftp.URL = "ftp.microsoft.com" Username
Type: String Default Value: None Notes: The username that you want to use to connect to the remote machine. Example: ftp.Username = "jblow" Password
Type: String Default Value: None Notes: The password that you want to use to connect to the remote machine. Example: ftp.Password = "super_secret_password" Port
Type: Long Integer (32 bits) Default Value: 21 Notes: The port of the FTP server that you wish to connect to. Example: ftp.port = 10000 Proxy
Type: String Default Value: null Notes: The name of your proxy server, if you have one. If you do not have a proxy server, you do not need to set this attribute. Example: ftp.proxy = "proxy.microsoft.com"
TransferType
Type: Ftp_Transfer_Type Default Value: TransferASCII (2) Notes: The default type of transfer you would like to use when transferring files to/from the remote server. Possible values for this property are 1 (TransferASCII) and 2 (TransferBinary). If you don't specify a value for this property, the default transfer type is TransferASCII. Example: ftp.TransferType = 1 or ftp.TransferType = 2 Passive
Type: Boolean Default Value: False Notes: Sets whether or not you wish to transfer your files using passive FTP semantics. This is useful when connecting to a FTP server through a firewall. Some firwalls will not allow regular ftp semantics. Example: ftp.Passive = True or ftp.Passive = false Directory
Type: String Default Value: "/" Notes: Get or set the directory on the remote FTP server using this property. If there is no connection open before this property is called, an error will occur. Example: ftp.Directory = "/softlib/mslfiles/"
Response.Write(ftp.Directory)Version
Type: String Default Value: None Notes: Read-only property that contains the current version of the component. Check this in your code if you are using version specific features of Majodio.FTP Example: Response.Write("Majodio.FTP Version: " & ftp.Version) Methods
OpenConnection() Description: The method will fail randomly once every ten instantiations. Please register the component to avoid this problem. Use this method to connect to the FTP server. You must assign appropriate values to the URL and Username before this method will succeed. If you do not assign values to these properties, the call will generate an error
Parameters: None Return Value: None Notes: An error will be generated if the call to the remote FTP server fails. It is recommend that the programmer take special care to do appropriate error checking. If you attempt to open a connection that is already open, the component will ignore your request and return to the program without error.
CloseConnection() Description: Use this method to close the connection to the FTP server. Parameters: None Return Value: None Notes: It is unnecessary to close the connection for this component to operate correctly, but it may cause some handles to remain open until the web server is rebooted. One or two of these handles are no big deal, but if your application runs for a long time these will start to accumulate causing memory problems. If you attempt to close an unopened connection, the component will ignore your request and return to the program without error.
PrintClient() Description: Use this method to print an FTP client to the HTML stream. This will allow you to navigate through an FTP server and download files directly to the web browser Parameters: None Return Value: None Notes: Simply call this method and it will add the FTP client into the HTML stream for you. There is no need to response.write the contents to the web browser.
DownloadFileToClient(RemotePath) Description: Downloads a file directly from the FTP server to the web browser. This method will clear any content that was in the HTML stream. If you do not have Response.Buffer set to true (the default in ASP 3.0), this method will fail. Parameters:
RemotePath String that contains the path of the file that you wish to download to the web browser Return Value: None Notes: As noted earlier, this method will clear any contents currently in the HTML stream and you page will not be able to issue any further commands as this method also issues a Response.End statement.
ExecuteCommand(Command, ExpectResponse) Description: Use this method to execute custom commands on the FTP server. Parameters:
Command String that contains the command that you want to execute on the FTP server. ExpectResponse Boolean to indicate that the command your issuing returns a response and you want to receive that response as the return value Return Value: If the ExpectResponse parameter is true, this value will contain the information requested, otherwise it will contain a null string. Notes: It is important to note that the ExpectResponse parameter should only be used when a response is expected. If you set this to true and there is no response returned from the FTP server, you may experience unexpected results (e.g. The web server may hang).
GetLastResponse() Description: Gets the last information that the FTP server returned on the FTP port. Parameters: None Return Value: String that contains the value of the last response from the FTP server. Notes: This command will not return extended information like directory listings or directory information (e.g. commands like
GetFile(RemotePath, LocalPath, Overwrite) Description: Use this method to get a file from the remote FTP server. Parameters:
RemotePath String that contains the path of the file you would like to grab from the FTP server (e.g. /test.txt). If you do not specify a path for the file, the component will search the current directory for a file with the given name. Use the directory property to set/get the current directory on the remote server. LocalPath String that contains the path where you would like to store the file on your web server. (e.g. c:\test.txt) Overwrite Boolean that indicates whether or not you want to overwrite the file if it exists on the local server. Set to True to overwrite and False to raise an error if the file already exists. Return Value: None Notes: None
PutFile(LocalPath, RemotePath) Description: Use this method to put a file from your web server to the remote FTP server. Parameters:
LocalPath String that contains the path of the file you wish to copy to the remote FTP server (e.g. c:\test.txt) RemotePath String that contains the path that you would like to copy the local file to. (e.g. /test.txt). If you do not specify a path for the file, the server will put the file in the current directory. Use the directory property to set/get the current directory on the remote server. Return Value: None Notes: None
DeleteFile(RemotePath As String) Description: Use this method to delete a file from the remote FTP server. Parameters:
RemotePath String that contains the path of the file you wish to delete from the remote FTP server (e.g. /test.txt). If you do not specify a path for the file, the server will search the current directory for a file matching the name of RemotePath and delete that file. If the server cannot find the file, it will cause an error. Use the directory property to set/get the current directory on the remote server. Return Value: None Notes: None
RenameFile(Existing, NewName) Description: Use this method to rename a file on the remote FTP server Parameters:
Existing String that contains the path of the existing file on the remote FTP server. If you do not specify a path for the file, the server will search the current directory for a file matching the name of Existing and rename that file. If the server cannot find the file, it will cause an error. Use the directory property to set/get the current directory on the remote server. NewName String that contains the new name of the file. Return Value: None Notes: None
Files() Description: Use this method to get a collection of all of the files in the current directory. The collection contains all of the attributes for a given file Parameters: None Return Value: FTPFile collection:
This collection contains all of the files in the current directory on the FTP server. The FTPFile collection has the following properties:
Filename: The name of the file/directory FileType: Directory = 1
File = 2FileSize: The size of the file. LastAccessTime: The last time the file was accessed. LastWriteTime: The last time the file was written to. CreationTime: The time the file was created. Example using the FTPFile collection:
Set ftp_files = ftp.files() For Each File In ftp_files Response.Write(File.Filename & " " & File.FileSize & "<br>") NextOr if you know the filename of your file use the following to get information about that file
Set ftp_files = ftp.Files() Response.Write(ftp_files("somefilename.txt").Filesize & "<br>")Notes: To set or get the current directory use the Directory property.
GetDirectoryListing(Directory_Listing_Type) Description: Use this method to get a listing of the directories and files in the current directory. It will return a list that contains date last updated, date last accessed, date created, file size, and file name. Parameters: Directory_Listing_Type Bitwise values that determine what is shown on in the directory listing. Here are the values that correspond to each attribute.
ShowFiles = 1
ShowDirectories = 2
ShowFileSize = 4
ShowLastAccessTime = 8*
ShowLastWriteTime = 16
ShowCreationTime = 32*
*Most FTP servers do not support this functionality and the component will usually return unknown as the resultThese values are used by adding up the values of each attribute you want to show and then putting that number as the parameter. For instance, if you wanted to show files, directories, and file size you would do the following.
1 (ShowFiles) + 2 (ShowDirectories) + 4 (ShowFileSize) = 7
So the call to GetDirectoryListing would look like this:
ftp.GetDirectoryListing(7)
Return Value: String containing a preformatted directory listing of the files in the current directory on the remote FTP server. Notes: To set or get the current directory use the Directory property.
GetDirectory(RemotePath, LocalPath, Overwrite, TraverseSubDirectories) Description: Use this method to get an entire FTP directory's contents and copy them to the local web server. Parameters:
RemotePath String that contains the path of the directory you would like to retrieve from the FTP server. This path should not include the name of a file LocalPath String that contains the path to the directory where you would like to store the files on your web server. (e.g. c:\inetpub\wwwroot). This path should not include the name of a file. Overwrite Boolean that indicates whether or not you want to overwrite the files if they exists on the local web server. Set to True to overwrite and False to raise an error if the file already exists. TraverseSubDirectories Boolean that indicates whether or not you want to go into sub directories and download all of the files in all of the sub directories on the remote FTP server. Return Value: None Notes: None
PutDirectory(LocalPath, RemotePath, TraverseSubDirectories) Description: Use this method to put an entire directory's contents from the local web server to the remote FTP server Parameters:
LocalPath String that contains the path to the local directory that you want to upload to the remote FTP server. This path should not include the name of a file RemotePath String that contains the path to the remote FTP directory that you want to put the files to. This path should not include the name of a file TraverseSubDirectories Boolean that indicates whether or not you want to go into sub directories and upload all of the files in all of the sub directories on the local web server. Return Value: None Notes: None
CreateDirectory(Directory) Description: Use this method to create a new directory on the remote FTP server. Parameters: Directory String that contains the name of the directory that you want to create. If you do not specify a path for the file, the server will create the directory in the current directory. Use the directory property to set/get the current directory on the remote server. Return Value: None Notes: To set or get the current directory use the Directory property.
RemoveDirectory(Directory) Description: Use this method to remove a directory from the remote FTP server. Parameters: Directory String that contains the name of the directory that you want to remove. If you do not specify a path for the file, the server will remove the directory from the current directory. Use the directory property to set/get the current directory on the remote server. Return Value: None Notes: To set or get the current directory use the Directory property. ASP Sample Page
Option Explicit On Error Resume Next '** '** Setup the variables for use in the script '** Dim ftp Dim ftp_files Dim File '** '** Create the FTP object using the CreateObject method '** set ftp = server.CreateObject("majodio.ftp") '** '** initialize the component with all of the necessary information to connect '** to the FTP server. '** ftp.URL = "ftp.microsoft.com" ftp.Username = "anonymous" ftp.Password = "someone@nowhere.com" ftp.TransferType = 1 ' ** ASCII ftp.Passive = True ' ** Allow for connections through a firewall '** '** Open the connection '** ftp.OpenConnection() Call sCheckForError(err, "Failed to open connection to FTP server") '** '** Change the current directory to /softlib/mslfiles/ '** ftp.directory = "/softlib/mslfiles/" Call sCheckForError(err, "Failed to change directory on FTP server") '** '** Print the current directory '** Response.Write(ftp.Directory & "<br>") Call sCheckForError(err, "Failed to get the current directory on FTP server") '** '** Get a preformatted list of all of the files and directories and all of their '** attributes in the current directory on the FTP server '** Response.Write("<pre>" & ftp.GetDirectoryListing(63) & "</pre><br>") '** '** Another way to list all of the files in the current directory on the FTP server '** using a collection object. '** Set ftp_files = ftp.Files() For Each File in ftp_files Response.Write(File.Filename & " " & File.FileSize & "<br>") Next '** '** If you know the filename you can go directly to a give file and get information '** on that file. This example shows how to get the file size of the file XMS.EXE '** on Microsoft's FTP server. '** Response.Write(ftp_files("XMS.EXE").Filesize) ftp.GetFile "110to130.exe", "c:\110to130.exe", True Call sCheckForError(err, "Failed to get file from remote FTP server") '** '** Put the entire web root directory and all sub directories to the FTP server '** Be careful that you script does not time out while waiting for the files '** to be put to the remote FTP server. '** ftp.PutDirectory Server.MapPath("/"), "/", True Call sCheckForError(err, "Failed to put the local directory to the remote FTP server") '** '** Get the entire root directory of the FTP server and put it in the root directory of '** the local web server. Be careful that your script does not time out while waiting '** for the files to be retrieved. '** ftp.GetDirectory "/", Server.MapPath("/"), True, True Call sCheckForError(err, "Failed to get directory from remote FTP server") ftp.CloseConnection() Set ftp_files = Nothing Set ftp = Nothing Sub sCheckForError(obj_err, str_msg) If Err.Number <> 0 Then Response.Write(str_msg) Response.End End If End Sub
In order to instantiate a copy of the component, use the ASP command Server.CreateObject("Majodio.FTP").
Example:
set http = Server.CreateObject("Majodio.HTTP")Properties
URL
Type: String Default Value: None Notes: Write only property containing the URL and path of the machine and file that you are attempting to connect to. Example: http.URL = "www.microsoft.com/default.asp" ServerName
Type: String Default Value: None Notes: The name of the server that you are attempting to connect to. This property cannot be queried until the URL property has been set Example: Response.Write(http.ServerName & "<br>") Path
Type: String Default Value: None Notes: Read-only property containing the path of the file on the server. This property cannot be queried until the URL property has been set. Example: Response.Write(http.Path & "<br>" Content
Type: String Default Value: None Notes: Read-only property containing the content returned from the web page Example: Response.Write(Server.HTMLEncode(http.Conent) & "<br>") Headers
Type: Collection Default Value: None Notes: Contains the names and values of a all of the server side headers from the HTTP server. This collection is only relevant after a connection has been successfully opened. Example: Set headers = http.Headers For Each item in headers Response.Write(item.name & ": " & item.value) NextVersion
Type: String Default Value: None Notes: Read-only property that contains the current version of the component. Check this in your code if you are using version specific features of Majodio.HTTP Example: Response.Write("Majodio.HTTP Version: " & http.Version) Methods
OpenConnection() Description: Used to open the connection to the HTTP server Parameters: None Return Value: None Notes: This method fills in all of the read-only properties noted above. You must call this method before those properties will be valid.
ASP Sample Page
Option Explicit dim http '** Create an instance of the object Set http = Server.CreateObject("Majodio.HTTP") '** Setup the property http.URL = "http://www.microsoft.com" '** Open connection to the HTTP server http.OpenConnection() '** Print all of the headers that were returned Set headers = http.Headers For Each item in headers Response.Write(item.name & ": " & item.value & "<br>") Next '** Print a specific header that was returned. Response.Write(headers("Connection")) '** Print the content of the web page that was returned. Response.Write(Server.HTMLEncode(http.Content) & "<br>")
BY INSTALLING THIS SOFTWARE, YOU AGREE TO BE BOUND BY ALL THE TERMS AND CONDITIONS OF THIS LICENSE AGREEMENT.
SOFTWARE LICENSE AGREEMENT
This Agreement is a license agreement between you and MAJODIO SOFTWARE for the use of the enclosed software (the "Software"). The Software is protected by both United States and International copyright law. Therefore, you must treat this license and the Software just like a book, with the following exceptions: you agree, pursuant to the license, not to rent or lease the Software in any form. In addition, you may not make any copies of the Software, except that you may make one archival copy of the Software for the sole purpose of backing you your Software and protecting your Investment from loss. This copy must include all copyright notices on the Software. By saying "just like a book" MAJODIO SOFTWARE means that the Software may be used under the license by any number of people, and may be freely moved from one computer location to another so long as there is no possibility of its being used at one location while it is simultaneously used at another. For example, just as a book cannot be read by two Different people in two different places at the same time, neither can the Software be used by used (without violating this agreement) by two different people in two different places at the same time.
This license is not a sale. Title and copyrights to the Software, accompanying Documentation and any copy made by your remain with MAJODIO SOFTWARE. Unauthorized copying of the Software or the accompanying Documentation or failure to comply with the above restrictions, will result in automatic termination of this license and will make available to MAJODIO SOFTWARE other legal remedies. Upon termination of this license, you must return all copies of the Software to MAJODIO SOFTWARE and erase any copies from your hard disk.
Permitted uses
You may operate the Software on a single computer or on a single workstation on a network provided you do not exceed the number of "nodes" shown on this license agreement. The number of nodes for this particular license agreement is unlimited. Additional Nodes or workstations utilizing the Software must be licensed by MAJODIO SOFTWARE.
Uses not permitted
You may not:Make copies of the Software, except as permitted in this agreement. Make copies of Related Materials. Alter, decompile, disassemble, or reverse engineer the Software. Remove, or alter the MAJODIO SOFTWARE copyright, and trademark notices. Remove, or alter the icons within the Software Rent, lease, sub-license or transfer the Software, Software copies, Related Materials or your rights under this license without the prior written consent of MAJODIO SOFTWARE.
SOFTWARE LIMITED WARRANTY
The warranty applies to the Software, the use of which is hereby licensed, the media on which it is supplied, and the Documentation supplied with it. MAJODIO SOFTWARE warrants for thirty (30) days from the date of delivery that the media on which the Software is supplied will be free from any defects described in the Documentation, when used on the supported hardware and system software listed on this Software package, provided such hardware and system software is in good working order. If you use this Software on anything but the supported hardware and system software listed on the back of this package, you do so at your own risk. MAJODIO SOFTWARE does not give any warranty (express or implied) that the Software will work under those conditions. Memory resident of "pop-up" programs, being part of the operating environment, constitute system software for this purpose; MAJODIO SOFTWARE cannot warranty compatibility with any such program. MAJODIO SOFTWARE's entire liability and your exclusive remedy under this warranty (which is subject to you returning the Software to MAJODIO SOFTWARE or an authorized dealer with a copy of your receipt) will be, at MAJODIO SOFTWARE's option, to attempt to correct or help you around errors with efforts which MAJODIO SOFTWARE believes suitable to the problem to replace the Software with functionally equivalent software or diskettes, as applicable, or to refund the purchase price and terminate this Agreement.
EXCEPT FOR THE PRIOR EXPRESS LIMITED WARRANTIES, MAJODIO SOFTWARE MAKES, AND YOU RECEIVE, NO WARRANTIES, EXPRESS, IMPLIED STATUTORY OR IN ANY COMMUNICATION WITH YOU AND MAJODIO SOFTWARE SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. MAJODIO SOFTWARE DOES NOT ARRANT THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE. Some states do not allow the exclusion of implied warranties so the above exclusion may not apply to you. This warranty gives you specific legal rights. You may also have other rights, which vary from state to state.
LIMITATION OF LIABILITY
IN NO EVENT WILL MAJODIO SOFTWARE BE LIABLE FOR ANY DAMAGES, INCLUDING LOSS OF DATA, LOST PROFITS, COST OF COVER OR OTHER SPECIAL INCIDENTAL CONSEQUENTIAL OR INDIRECT DAMAGES ARISING FROM THE USE OF THE SOFTWARE OR ACCOMPANYING DOCUMENTATION, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY. THIS LIMITATION WILL APPLY EVEN IF MAJODIO SOFTWARE OR ANY AUTHORIZED DEALER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. YOU ACKNOWLEDGE THAT THE LICENSE FEE REFLECTS THIS ALLOCATION OF RISK. SOME STATES DO NOT ALLOW LIMITATION OR EXCLUSION OF LIABILITY FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THE ABOVE LIMITATION MAY NOT APPLY TO YOU.
GOVERNMENT USE
Use, duplication or disclosure by the U. S. Government is subject to restrictions as set forth in FAR 52-227-19 (Commercial Computer Software-Restricted Rights) and SFAR 252-227-7013 (c) (1) (iii) (Rights in Technical Data and Computer Software), as applicable.
GENERAL
This agreement will be governed by the laws of the State of NEBRASKA and not by the 1980 U. N. Convention on Contracts for the International Sale of Goods. This agreement is the entire agreement between us and supersedes any other communication or advertising with respect to the program and accompanying documentation. If any provision of this Agreement is held invalid, the remainder of this Agreement shall continue in full force and effect.
INTERNATIONAL SALES
If you purchase this product in any other country besides the United States, you agree to the following: The parties hereto confirm that it is their wish that this Agreement, as well as all other documents relating hereto, including Notices, have been and shall be drawn up in the English language only.