How to FTP?

Hello,

  Actually I have a couple questions.  The first is, is there a way to FTP a file on the local computer to a server on the internet?  If so, is there an easy way to do this?  Could you please provide some code to do so?  All I need to do is upload one text file and then disconnect.

Thanks...
ingenitoAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
BelatucadrosConnect With a Mentor Commented:
This should help you, and if not, jsut search "FTP" there, there are alot of them that use the winsock API, but you weren't happy with the microsoft one so I decided to try this one ;)

http://www.planet-source-code.com/vb/default.asp?lngCId=3900&lngWId=1&blnFrm=true

Hope that helps!!
0
 
autCommented:
1. Yes, what you are trying to do can be done.

2. For an easy way to do this, use the INet control...

However, this will increase the size of your application dramatically. For sample source code to an advanced way to do it (using the WinInet API), check out this url:
http://support.microsoft.com/support/downloads/LNP470.asp

The link you are looking for is titled:
"VBFTP.EXE: FILE: VBFTP.EXE: Implementing FTP Using WinInet API from VB"

Or you can download the source code directly from:
http://support.microsoft.com/download/support/mslfiles/VBFTP.EXE
(note: you have to register your copy of VB before you can download)
0
 
ingenitoAuthor Commented:
aut,

  Thanks, but I already had that program, but it was very confusing.  If you could, please tell me the way using the INET Control or tell me the code I need to use with the example above just to FTP a simple file.  I'll increase the points. Thanks.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
ingenitoAuthor Commented:
by example above, I mean the WinINet API
0
 
mcriderCommented:
To transfer the file, put something like this in a command button:

    Inet1.URL = "ftp://www.yoursite.com
    Inet1.UserName = "yourusername"
    Inet1.Password = "yourpassword"
    Inet1.Execute , "PUT c:/windows/desktop/yourfile.txt Yourfile.txt"
    Do While Inet1.StillExecuting = True
        DoEvents
    Loop


Cheers!
0
 
mcriderCommented:
By the way, my answer uses the WinInet Control...


Cheers!
0
 
MoMarviCommented:
A good free ftp control can be downloaded at http://www.fp.gvn.net/bradley/xFtp/xftpprod.htm.

It includes full documentation, and allows for monitoring the progress of the file transfer, which the M$ Inet cannot. (This is very important for long downloaads, when you want to provide the user with some feedback as to what is going on)
0
 
ingenitoAuthor Commented:
mcrider,


   How do I declare this variable?  And what is the WinInet control named?  The only control I see when adding is 'Microsoft Internet Control'.  Is that the right one?
0
 
mcriderCommented:
To add the WinInet Control, right-click on the toolbox (the window where you select textboxes, pictureboxes, labels, etc.) and select "Components...".

Scroll down in the box until you see "Microsoft Internet Transfer Control" and select it from the list (MSINET.OCX).

Make sure you have VB Service Pack 3 installed... There are quite a few fixes in this service pack...

See Visual Studio 97 Service Pack 3 - Readme
http://msdn.microsoft.com/vstudio/sp/vs97/readme.asp 
 

Hope this helps!


Cheers!
0
 
ingenitoAuthor Commented:
mcrider,

  I do not have that control listed.  All I have listed is 'Microsoft Internet Controls'.  Is that the same thing?  If not, where can I get it.  Also, what is the call I would use to declare the variable?  dim Inet as what??  thanks!
0
 
mcriderCommented:
No, they are not the same...

Microsoft Internet Controls is SHDOCVW.DLL
Microsoft Internet Transfer Controls is MSINET.OCX

What version on VB do you have?  If you have VB5 or VB6, have you installed Service Pack 3?

Look on your system for MSINET.OCX...


Cheers!
0
 
ingenitoAuthor Commented:
mcrider,

  I'm sorry, I bought the Learning Edition of VB which apparantly does not come with msinet.ocx.  Thanks though.
0
 
smilieCommented:
Hi all,

I am using "Internet Transfer Control" to send file to other servers. I am able to send file for one server like:
   Inet1.URL = "ftp://www.yoursite.com
   Inet1.UserName = "yourusername"
   Inet1.Password = "yourpassword"
   Inet1.Execute , "PUT c:/windows/desktop/yourfile.txt Yourfile.txt"

Could anyone knows how to disconnect FTP after sending a file to be able to resend to another server.
Also how to sent a file to multi FTP servers.

Pl help, thankyou.
Regards
Smilie
0
All Courses

From novice to tech pro — start learning today.