|
A lot of people have asked me to write a program that will allow them to upload files from their programs, to their sites. Here is a simple dynamic link library I wrote to answer these requests.
Its usage is pretty simple:
1) First you have to register the dll on your PC.
regsvr32 TKUploadFile.dll
2) Add a reference to TKUploadFile.dll in your program.
3) 3 methods are exposed, as follows:
- Connect(), Opens the ftp session
- UploadFile() Uploads the file to server
- Disconnect(), Closes the ftp session.
Example:
Private Const scFTPSERVER As String = "ftp.mysite.com"
Private Const scUSER As String = "username"
Private Const scPASSWORD As String = "password"
Private Sub Command1_Click()
Dim o As New clsSession
Dim i As Long
o.Connect scFTPSERVER, scUSER, scPASSWORD
i = o.UploadFile("C:\MyPic.jpg", "/MyUploadFoler/MyPic.jpg")
If i = 0 Then
MsgBox "OK"
Else
MsgBox "ERROR"
End If
o.Disconnect
Set o = nothing
End Sub
[ download file ] - TKUploadFile.zip 7KB
About the author: Thomas is an experienced Visual Basic developer, with expertise of 7+ years developing especially financial applications. His main IT skills are VB, SQL, Crystal Reports - should you need a Visual Basic developer for your projects feel free to contact Thomas through his personal website at www.Kaloyani.com
Source: www.VBprofs.com
|