-
Is there a problem using Inet with Windows 2000?
I was attempting to use the following code with no success:
Code:
Private Sub cmdSend_Click()
Dim strFileName As String, strFileTitle As String
strFileName = CommonDialog1.FileName
strFileTitle = CommonDialog1.FileTitle
With Inet1
.Protocol = icFTP
.URL = "xxx.xxx.xxx.xxx"
.UserName = "xxx"
.Password = "xxx"
.Execute , "PUT " & strFileName & " " & strFileTitle
End With
End Sub
However, this piece of code worked:
Code:
Private Sub cmdSend_Click()
With Inet1
.Protocol = icFTP
.URL = "xxx.xxx.xxx.xxx"
.UserName = "xxx"
.Password = "xxx"
.Execute , "PUT C:\Test.txt Test.txt"
End With
End Sub
This code does not work either:
Code:
Private Sub cmdSend_Click()
Dim strFileName As String, strFileTitle As String
strFileName = CommonDialog1.FileName
strFileTitle = CommonDialog1.FileTitle
With Inet1
.Protocol = icFTP
.URL = "xxx.xxx.xxx.xxx"
.UserName = "xxx"
.Password = "xxx"
.Execute , "PUT " & "'" & strFileName & "'" & " " & "'" & strFileTitle & "'"
End With
End Sub
-
Sorry my bad english :-)
if strFileName include space-mark, like this:
C:\My Files\test.txt THIS NOT WORK!!!
Try this way:
"PUT ""C:\MY PROGRAMS\ME.JPG"" ME.JPG" should also work
Or you could convert it to a short path:
Option Explicit
Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
Private Const MAX_PATH As Long = 260
Private Function GetShortPath(sLongPath As String) As String
Dim sBuffer As String
Dim lRet As Long
sBuffer = Space$(MAX_PATH)
lRet = GetShortPathName(sLongPath, sBuffer, MAX_PATH)
sBuffer = Left$(sBuffer, InStr(sBuffer, vbNullChar) - 1)
End Function
Private Sub Command1_Click()
MsgBox GetShortPath("C:\Program Files")
End Sub
I hope this helps you...
- Dj4