主题:  网络发布常见问题(二)

魔岩

职务:版主
等级:6
金币:34.0
发贴:4453
#12002/6/8 15:19:14
网络发布中关于ReadExtFile和WriteExtFile的注意问题

Common mistakes with ReadExtFile and WriteExtFile
When moving a previously created Authorware file to the Web for playback, people often have several questions regarding the ReadExtFile and WriteExtFile.

ReadExtFile
ReadExtFile, when used in a Web packaged file, accepts either a drive based pathname (similar to a non Web packaged file) or a URL.

Note: This URL can be either an "http://" format or "file://" format. To see what the URL should be for a local file, open the text file in Netscape, and make sure the "Show Location" option is checked. You will see something like "file:///D|/myfile.txt" (on Windows) or "file:///Hard Drive/myfile.txt" (on Macintosh). On the Macintosh, you can hold down the option key when selecting Open from the file menu, to access all types of files.

WriteExtFile and FTP
WriteExtFile works the same in a Web packaged file as it does in a non Web packged file in that you can only write a file to the local hard drive. You cannot specify a URL to write a file to using WriteExtFile. To write a text file to an Internet server (FTP server), you will need to use the FTP UCD or XCMD.

A typical sequence of steps to write a file to an FTP server are as follows: 1 Use WriteExtFile to write the file to a local drive.
Note: If you specify the path as FileLocation^"myfile.txt", you are guaranteed that it will be written to a valid path on the user's hard drive.

2 Use the FtpOpen function to initialize an FTP session.
3 Test for the successful execution of FtpOpen. A zero is returned if an error occurred; otherwise, the return value is the handle to the FTP session.
4 Use the FtpConnect function to open an FTP connection to a specific server.
5 Test for the successful execution of FtpConnect using the FtpStatus function. If the return value is 1, the operation is still waiting. If the return value is < 0, the operation has failed. if the return value is 0, the operation was successful.
Note: You need to specify the server name, user name, and password. Some servers require connection to a specific port. If you are unsure about the port, specify "" (an empty string) as the port number. If you still have problems establishing a connection, contact your ftp server administrator to find out a specific port number to specify.

Also Note: See the example file FTPDEMO.A3W (included in the FTP UCD/XCMD download) for an example of how to wait for the FtpStatus to return something besides 1 before continuing. The interaction icon named "FTP Status" is an example of one way to do this. The user shouldn't continue through the flow until the function has failed (return of FtpStatus is < 0) or completed successfully (return of FtpStatus = 0).

6 Use the FtpStore function to upload the file to the FTP server.
7 Test for the successful execution of FtpStore using the FtpStatus function.
8 Use the FtpDisconnect to shut down the FTP connection.
9 Test for the completion of the FtpDisconnect operation using the FtpStatus function. if the return value is 1, the operation is still waiting. If the return value is < 0, the operation has completed.
10 Use the FtpClose function to release system resources allocated for the FTP session.


Note: It is important to test for the success or failure of each asynchronous function. The nature of certain ftp functions is that there will not immediately be a success or failure return, but there will be a "waiting" period during which the return value is typically 1. Asynchronous functions are noted as such in the function description in the "Show Functions" dialog box.

编辑历史:[这消息被Rock编辑过(编辑时间2002-06-08 15:22:44)]
[这消息被Rock编辑过(编辑时间2002-06-08 15:24:13)]