Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ftp upload using VB not working

Status
Not open for further replies.

pbuddy2007

Technical User
Feb 9, 2008
17
0
0
CA
I'm trying to create a routine that will upload the conent of a folder to a webserver using a FTP connecttion....the problem is that it works on one server but doesn't on my new hosting server


1- The FTP intitial directory after login is the root "/" directory
2- yes the ftp account has all the privileges
3-


Code:
Dim i As Long
  Dim sError      As String
  Dim strFullPath As String, strRelativeName As String, strRelativePath As String
  Dim objFTP As ASPFTP
  Dim strMsg
  Dim profilenum As Integer
  Dim tdesign As String
  
  Dim wsh

'On Error Resume Next
Set wsh = CreateObject("WScript.Shell")

  
    
  PathLogInit
  LogPath App.Path & "\output\site1", strFNAMES, lngPptrs, strPaths
  
  'create reference to object
  Set objFTP = New ASPFTP
  
  objFTP.sServerName = "1.2.3.4"
  objFTP.sUserID = "user"
  objFTP.sPassword = "pass"
  
  If objFTP.bConnect() Then
    objFTP.bMakeDir "public_html\site3"
    
    For i = 0 To UBound(strFNAMES)
    
      strFullPath = strPaths(lngPptrs(i)) & strFNAMES(i)
      strRelativeName = GetRelativeName(strFullPath)
      strRelativePath = GetRelativePath(strFullPath)
      strRelativePath = "\public_html\site3" & strRelativePath
      strRelativeName = "\public_html\site3" & strRelativeName
      

        
      'now make the directory
      Label5.Caption = "Creating folder " & strRelativePath & vbCrLf
      DoEvents
      objFTP.bMakeDir strRelativePath
      Label5.Caption = "Copying file " & strRelativeName & vbCrLf
      DoEvents
      objFTP.bPutFile strFullPath, strRelativeName
    Next i
    Set objFTP = Nothing
else

  'error code
end if
 
Looks like the '\' should be '/' on your server addresses

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
Doesn`t work, even with the '/'

on my other webserver it did work with the mistaken '\'

Any other ideas ? I'm all out of options.

The person who answers that one will be named the VB god of the month !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top