Difference between revisions of "How to FTP a file to a remote server with AC7"

From AbleCommerce Wiki
Jump to: navigation, search
(New page: '''Introduction''' AbleCommerce 7 includes a nifty little FTP component that makes uploading and downloading files via FTP a snap. This brief tutorial will explain how to do a simple FTP ...)
 
 
(3 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
AbleCommerce 7 includes a nifty little FTP component that makes uploading and downloading files via FTP a snap. This brief tutorial will explain how to do a simple FTP upload to a remote site. Remember, since .Net programming is all server-side, this is from the perspective of your web server and not your web browser. In other words, this is how you make your web server upload a file to a remote FTP site.  
 
AbleCommerce 7 includes a nifty little FTP component that makes uploading and downloading files via FTP a snap. This brief tutorial will explain how to do a simple FTP upload to a remote site. Remember, since .Net programming is all server-side, this is from the perspective of your web server and not your web browser. In other words, this is how you make your web server upload a file to a remote FTP site.  
  
'''The Magic
+
'''The Magic'''
'''
+
 
 
Here's a code snippet that makes an FTP connection and uploads a file:
 
Here's a code snippet that makes an FTP connection and uploads a file:
  
 +
<code><pre>
 
                 Dim _FTPCon As New FTPConnection
 
                 Dim _FTPCon As New FTPConnection
 
                 Try
 
                 Try
Line 19: Line 20:
 
                     ' Upload or connect failed
 
                     ' Upload or connect failed
 
                 End Try
 
                 End Try
 +
</pre></code>
  
 
Notice how using the TRY/CATCH command allows you to catch if the upload failed. The FTP component is designed to throw an exception if either the upload or the connect command fails. Also note that you do not have to specify the FTP:// in the host URL.
 
Notice how using the TRY/CATCH command allows you to catch if the upload failed. The FTP component is designed to throw an exception if either the upload or the connect command fails. Also note that you do not have to specify the FTP:// in the host URL.
  
 
'''More Documentation'''
 
'''More Documentation'''
 +
 
You can find the documentation for this nifty FTP component at http://www.enterprisedt.com/products/edtftpnetpro/documentation.html. The links in the online documentation do not fully work because their online docs assume you've installed the component from their CD. But there's enough there to get your started - the rest can be exposed through the Visual Studio Object Browser or simply by using the Intellisense feature in VS.
 
You can find the documentation for this nifty FTP component at http://www.enterprisedt.com/products/edtftpnetpro/documentation.html. The links in the online documentation do not fully work because their online docs assume you've installed the component from their CD. But there's enough there to get your started - the rest can be exposed through the Visual Studio Object Browser or simply by using the Intellisense feature in VS.
  
 
'''Conclusion'''
 
'''Conclusion'''
Automation is one of many keys to getting those profit margins you seek. Always try to spend more time running your business and less time doing data entry. Your bank account (and your significant other) will thank you
+
 
 +
Automation is one of many keys to getting those profit margins you seek. Always try to spend more time running your business and less time doing data entry. Your bank account (and your significant other) will thank you.
 +
 
 +
==Reference==
 +
Originally posted in forums by Joe Payne http://forums.ablecommerce.com/viewtopic.php?f=47&t=7566
 +
 
 +
[[Category:AbleCommerce 7]]

Latest revision as of 11:31, 15 August 2013

Introduction

AbleCommerce 7 includes a nifty little FTP component that makes uploading and downloading files via FTP a snap. This brief tutorial will explain how to do a simple FTP upload to a remote site. Remember, since .Net programming is all server-side, this is from the perspective of your web server and not your web browser. In other words, this is how you make your web server upload a file to a remote FTP site.

The Magic

Here's a code snippet that makes an FTP connection and uploads a file:

                Dim _FTPCon As New FTPConnection
                Try
                    _FTPCon.ServerAddress = "ftp.yourftpsite.com"
                    _FTPCon.ServerPort = 21
                    _FTPCon.UserName = "ftp_user"
                    _FTPCon.Password = "ftp_password"
                    _FTPCon.Connect()
                    _FTPCon.UploadFile(_LocalName, _RemoteName)
                    ' File uploaded successfully
                Catch ex As Exception
                    ' Upload or connect failed
                End Try

Notice how using the TRY/CATCH command allows you to catch if the upload failed. The FTP component is designed to throw an exception if either the upload or the connect command fails. Also note that you do not have to specify the FTP:// in the host URL.

More Documentation

You can find the documentation for this nifty FTP component at http://www.enterprisedt.com/products/edtftpnetpro/documentation.html. The links in the online documentation do not fully work because their online docs assume you've installed the component from their CD. But there's enough there to get your started - the rest can be exposed through the Visual Studio Object Browser or simply by using the Intellisense feature in VS.

Conclusion

Automation is one of many keys to getting those profit margins you seek. Always try to spend more time running your business and less time doing data entry. Your bank account (and your significant other) will thank you.

Reference

Originally posted in forums by Joe Payne http://forums.ablecommerce.com/viewtopic.php?f=47&t=7566