The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
Uploading Files to an FTP site with code
Posted: 05 Dec 07 7:33 PM
|
I am hoping to be able to upload files to an FTP site in legacy script. I was trying to use the code found here(http://www.scriptcode.co.uk/ftp_connect_and_upload.htm) as an example but unfortunately cannot get it to work. If someone could point me in the right direction it would be most appreciated. |
|
|
|
Re: Uploading Files to an FTP site with code
Posted: 05 Dec 07 9:16 PM
|
I use a .bat file to upload files to an FTP server in Legacy.
"open servername username password cd .. lcd C:\directory of the outgoing file ascii cd /place to put the file put C:\file to move quit"
and I call the .bat file using SQL DTS, but I'm excited to use this more modern method in v7.0. |
|
|
|
Re: Uploading Files to an FTP site with code
Posted: 05 Dec 07 9:24 PM
|
Thx Ian. I actually just found a dll I purchased which is an activeX component that seems to work well. (http://www.chilkatsoft.com/) Most of my users are Terminal server users so I don't have to register the component on too many PC's. I also can check for failed uploads etc. |
|
|
|
Re: Uploading Files to an FTP site with code
Posted: 06 Dec 07 4:15 AM
|
This uses the embedded ftp client within IE/Windows Explorer:
strFTP = "ftp://" & FTPUser & ":" & FTPPass & "@" & FTPHost & FTPDir Set objFTP = oShell.NameSpace(strFTP)
This may/may not work depending on your OS/Version of IE.
What is that yuo are trying to do ? It would most likely be easiest to create a command file (e.g ftp.cmd) and then pass it details via "ftp -v -i -s:file.txt" - you can then pass this out to shell to run. |
|
|
|
Re: Uploading Files to an FTP site with code
Posted: 06 Dec 07 8:32 AM
|
The thing you have to watch for is timing... i.e. are you doing a blind toss of the file on to the server, or are you doing something based on when it completes. The activex may get you that, and on a single site deployment seams a decent way to go.
If timing is an issue and you are using the CMD file approach, then you have to do a lock file and monitor it so you will know that the transfer is complete.
ws |
|
|
|
Re: Uploading Files to an FTP site with code
Posted: 06 Dec 07 10:05 AM
|
If it has to be done from the SLX client, I would definitely go the route of just making an easy job of it and using a commercial component and use it from a .NET Extension (if you're on 7.x or higher) or as an outside exe to kick off (if on prior versions).
If it doesn't necessarily need to be done via the client and can be done from the SLX server as a job, then SSIS/DTS has built in capabilities to send files off to other servers with little effort.
-Ryan |
|
|
|