How to Easily Use FTP in WSH - Creating a Text File
(Page 4 of 4 )
Finally, we’ll take a look at how to create a text file on the remote server using a provided text string. You could also manipulate this code to read from a TextStreamObject. What uses can you find for that?
Function CreateTextFile(rDir, rFile, strContents)
If objFtp.IsConnected Then
success = objFtp.ChangeRemoteDir(rDir)
If (success <> 1) Then
CreateTextFile = objFtp.LastErrorText
Exit Function
End If
success = objFtp.PutFileFromTextData(rFile, strContents)
If (success <> 1) Then
CreateTextFile = objFtp.LastErrorText
Exit Function
End If
CreateTextFile = "ok"
End If
End Function
This is only the beginning of what you can accomplish using the Chilkat FTP control. Stop by and take a look at the documentation for more ideas.
http://www.chilkatsoft.com/refdoc/xChilkatFtpRef.html
That’s all for now. I hope you find this ActiveX control useful. I’m confident that once you begin using it, you will definitely want to add it to your arsenal. Thanks for reading. Until next time, keep coding!
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |