VB. NET uses ftp.exe to upload files to the FTP server

Source: Internet
Author: User
Tags ftp commands

Public class form1 <br/> private sub into trans_click (byval sender as system. object, byval e as system. eventargs) handles implements trans. click <br/> dim PSI as new system. diagnostics. processstartinfo <br/> dim ftpfilename as string </P> <p> psi. filename = "ftp.exe" <br/> psi. redirectstandardinput = false <br/> psi. redirectstandardoutput = true <br/> psi. useshellexecute = false </P> <p> ftpfilename = "E:/ftp.txt" <br/> psi. arguments = "-S:" & ftpfilename </P> <p> dim proc as Process <br/> proc = process. start (PSI) <br/> 'wait Process <br/> Proc. waitforexit () <br/> console. writeline (Proc. standardoutput) <br/> console. readline () <br/> end sub <br/> end class <br/>

 

Content in ftp.txt:

Open 192.168.1.110

 

User dumeifang
Put E:/ip.html
Quit

 

Console output:

Ftp> open 192.168.1.110
Connected to 192.168.1.110.
220 Serv-u ftp server v8.2 ready...
User (192.168.1.110 :( none )):
530 invalid user name.
Login Failed.
Ftp> User dumeifang
331 user name Okay, need password.
230 user logged in, proceed.
Ftp> put E:/ip.html
200 PORT command successful.
150 opening ASCII mode data connection for ip.html.
226 transfer complete. 1,672 bytes transferred. 1.63 KB/sec.
FTP: Send 1672 bytes, 0.00 seconds 1672000.00 Kbytes/sec.
Ftp> quit
221 goodbye, closing session.

 

 

FTP-S: filename is to write some FTP commands into filename, and FTP automatically runs the content

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.