Click here to Skip to main content
15,890,995 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi everyone!

I has a problem that needs your help.

My problem is that I want to send a text file from Win XP to Unix machine using VB6.

I do not how to code it.

I hope that you will help me.

thanks.
Posted
Updated 16-Jan-11 21:32pm
v3
Comments
Dalek Dave 17-Jan-11 3:32am    
Edited for Grammar and Readability.

If you can enable Samba shares on the Unix system, then sending a file may be as simple as a local file copy. I believe VB6 has a Shell command that lets you invoke commands like copy or alternatively VB6 lets you invoke the API. You can use the CopyFile API.
 
Share this answer
 
You can use System.Net.WebClient

Here is an example:
Simple FTP file upload in C# 2.0[^]

And here is another for VB6
http://www.vbforums.com/showthread.php?t=278027[^]

Regards
Espen Harlinn
 
Share this answer
 
v3
Comments
ngthtra 12-Jan-11 0:02am    
thank your help .I will try it and tell you about result
Dalek Dave 17-Jan-11 3:32am    
Good Call.
ngthtra 17-Jan-11 3:34am    
but this code is in C# but how is VB6 ?
in VB6 is used which lib to send file?
I tried ti this code but it is unsuccesful because in VB6 do not use system.net.webclient
Espen Harlinn 17-Jan-11 9:19am    
Thanks Dalek!
Espen Harlinn 17-Jan-11 9:56am    
Votes of 1,2 and 3? Could somebody please elaborate? He's got his answer for VB6 and the c# example shows the benefit of upgrading to .Net
thanks Espen Harlinn's code
but my application is Window application and I used VB6 not C#.
you can give me other code that it run in VB6?
 
Share this answer
 
Comments
Espen Harlinn 17-Jan-11 9:45am    
I've added a reference to a VB6 FTP client excample, just hope you will find it useful :)
thanks your helping.
I resolved my problem, but my file has min size so I used control INET of VB to send file.
this is my code:
'sDestFile is destination file
Public Function SendTestFile(sHostName As String, sLogin As String, sPassword As String, sSourceFile As String, sDestFile As String) As String
    Dim iRet As Integer
    iRet = 0
    On Error GoTo ErrTrip
    InetFTP.URL = sHostName
    InetFTP.Password = sPassword
    InetFTP.UserName = sLogin
    If InetFTP.StillExecuting Then InetFTP.Cancel
    InetFTP.Execute , "PUT " & sSourceFile & " " & sDestFile
    
    ' Wait for it to complete.
    Do While InetFTP.StillExecuting
        DoEvents
    Loop
    InetFTP.Execute , "CLOSE"
    SendTestFile = iRet
    Exit Function
ErrTrip:
    iRet = 1
    SendTestFile = iRet
    MsgBox ERR_SEND_UNSUCCESS & vbCrLf & sSourceFile & vbCrLf & Err.Description, vbCritical, MSG_ERROR_TITLE
End Function
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900