<원문 위치: http://groups.google.com/group/intersystems-public-cache/browse_thread/thread/8b5304021a433bdc# >
Below is some
code snippets from a class I wrote to
handle sending file via ftp:
Set ftp=##class(%Net.FtpSession).%New()
Set stat=ftp.Connect(..server,..username,..passwd)
If ..trsfrtype="B" {
Set stat=ftp.Binary()
Set Msg=" >Transfer method set to Binary"
Set stat=ftp.Ascii()
Set Msg=" >Transfer method set to Ascii"
if you need to change directories on the receiving system:
Set stat=ftp.SetDirectory(..serverdir)
When sending the file:
If ..filetype="B" {
Set sf=##class(%FileBinaryStream).%New()
Set sf=##class(%FileCharacterStream).%New()
Set sf.Filename=FILE
Set SendFile=..sendasname
set stat=ftp.Store(SendFile,sf)
If you need to rename the file on the receiving server:
Set stat=ftp.Rename(SendFile,NewName)
End your ftp session"
ftp.Logout()
hth,
Donnie
|