Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

HI AL

 

I am using VB.NET . But my script does not fit into VB.NET

 

I want to uplado file to server,

 

This is my CODE

 

Thanks,

Erdenemandal

Private Declare Function InternetOpen Lib "wininet" Alias "InternetOpenA" ( _
               ByVal lpszAgent As String, _
               ByVal dwAccessType As Long, _
               ByVal lpszProxyName As String, _
               ByVal lpszProxyBypass As String, _
               ByVal dwFlags As Long) _
       As Long
 Private Declare Function InternetConnect Lib "wininet" Alias "InternetConnectA" ( _
               ByVal hInternet As Long, _
               ByVal lpszServerName As String, _
               ByVal nServerPort As Long, _
               ByVal lpszUserName As String, _
               ByVal lpszPassword As String, _
               ByVal dwService As Long, _
               ByVal dwFlags As Long, _
               ByVal dwContext As Long) _
       As Long
Private Declare Function FtpPutFile Lib "wininet.dll" Alias "FtpPutFileA" (ByVal hConnect As Long, ByVal lpszLocalFile As String, ByVal lpszNewRemoteFile As String, ByVal dwFlags As Long, ByVal dwContext As Long) As Boolean


Me.mOPenHandler = InternetOpen("Curavis", Me.INTERNET_OPEN_TYPE_PRECONFIG, vbNullString, vbNullString, 0)

Me.hConnectedHandle = InternetConnect(mOPenHandler, "192.168.0.96", 21, userName, userPAss, 1, 0, 0)
If FtpPutFile(Me.hConnectedHandle, "C:\dirmap.txt", "/home/erdene/tssest.htm", &H0, 0) Then
                               MsgBox("OK")
                       Else
                               MsgBox("ONONO")
                               MsgBox(GetLastError.ToString)
                       End If

Posted

It is working NOW

 

Hi, ALL

 

I change as long into as integer, And it works . This is a code

 

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
               Dim INet, INetConn As Integer
               Dim RC As Boolean
               INet = InternetOpen("MyFTP Control", 1, vbNullString, vbNullString, 0)

               INetConn = InternetConnect(INet, "192.168.2.96", 0, userName, UserPass, 1, 0, 0)
               RC = FtpPutFile(INetConn, "c:\dirmap.txt", "/tmp/sss.sss", 1, 0)


               If RC Then MessageBox.Show("Transfer succesfull!")

               InternetCloseHandle(INetConn)
               InternetCloseHandle(INet)
       End Sub

       Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
               Dim INet, INetConn As Integer
               Dim RC As Boolean
               INet = InternetOpen("MyFTP Control", 1, vbNullString, vbNullString, 0)

               INetConn = InternetConnect(INet, "192.168.2.96", 0, userName, userPass, 1, 0, 0)
               RC = FtpGetFile(INetConn, "/tmp/sss.sss", "c:\temp\ssss.ext", True, 1, 0, 0)
               If RC Then MessageBox.Show("Transfer succesfull!")

               InternetCloseHandle(INetConn)
               InternetCloseHandle(INet)
       End Sub

 

 

this is a declaraiton

 

 

Public Declare Function InternetCloseHandle Lib "wininet.dll" (ByVal HINet As Integer) As Integer

       Public Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" (ByVal sAgent As String, ByVal lAccessType As Integer, ByVal sProxyName As String, ByVal sProxyBypass As String, ByVal lFlags As Integer) As Integer

       Public Declare Function InternetConnect Lib "wininet.dll" Alias "InternetConnectA" (ByVal hInternetSession As Integer, ByVal sServerName As String, ByVal nServerPort As Integer, ByVal sUsername As String, ByVal sPassword As String, ByVal lService As Integer, ByVal lFlags As Integer, ByVal lContext As Integer) As Integer


       Public Declare Function FtpGetFile Lib "wininet.dll" Alias "FtpGetFileA" (ByVal hFtpSession As Integer, ByVal lpszRemoteFile As String, ByVal lpszNewFile As String, ByVal fFailIfExists As Boolean, ByVal dwFlagsAndAttributes As Integer, ByVal dwFlags As Integer, ByVal dwContext As Integer) As Boolean


       Public Declare Function FtpPutFile Lib "wininet.dll" Alias "FtpPutFileA" (ByVal hFtpSession As Integer, ByVal lpszLocalFile As String, ByVal lpszRemoteFile As String, ByVal dwFlags As Integer, ByVal dwContext As Integer) As Boolean

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...