spacer
spacer

Visual Basic & VB.NET resources | VBprofs.com

Google
 
Main Menu
Home
IT News
Articles
Source Codes
Books
Calendar of Events
Publish your Content
Links Directory
Reviews and Recs
Premium Content
 VBprofs Premium Content Become a member to get access to our premium content! 

 Membership is entirely free, and allows you to:
  •  access programming projects posted by our partners;
  •  publish your articles, news, links;
  •  publish a project request;
  •  access our VB Careers section.
Polls
How did you reach VBprofs.com?
  
Which is your favorite programming language?
  
 
Home arrow Source Codes arrow Visual Basic arrow How to upload files from your program to a web site

How to upload files from your program to a web site PDF Print E-mail
Source Codes - Visual Basic
Written by Thomas Kaloyani   
Sunday, 02 April 2006
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.
 
[download file ] - TKUploadFile.zip 7KB
 
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
< Prev   Next >

 
Antivirus Shop
BitDefender Antivirus v10
Newsflash

PowerRefresh 1.0 released!
A simple yet extremely useful tool for webmasters, publishers and SEO working bees: PowerRefresh allows you to automatically refresh your IE windows every x minutes. It can handle unlimited number of windows and, unlike similar applications, is using full browsers.


Get PowerRefresh from Kaloyani.com: download
Login Form
Username

Password

Remember me
Forgotten your password?
No account yet? Create one
Popular

VBprofs.com - online resources for Visual Basic and VB.NET professionals: Visual Basic and VB.NET articles, industry news and events, career tools, VB / VB.NET books, calendar and much more. VBprofs.com is an interactive web site with free membership.
(c) Copyright 2005 - 2006 by VBprofs.com
powered by Mambo Open Source Software
spacer