Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

FTP utility for Access? >> not Devashish's

254 views
Skip to first unread message

Mike Hnatt

unread,
Nov 8, 2002, 6:34:55 PM11/8/02
to
Access 97/2002

I tried the FTP utility that "Dev" Ashsish has for Access.

http://www.mvps.org/access/modules/mdl0037.htm (thanks Jon, thanks Ashish)

However, It only works on some servers. The only guaranteed way I have
found to FTP something in Access is to shell out and run the FTP commands
from the DOS prompt.

Does anyone know of where I could even "buy" a plug in that works (without
having to shell out to a DOS prompt >> even running in the background is not
an option since the user doesn't have a meter). One with a status meter
would be nice.

Thanks,
Mike


PC Datasheet

unread,
Nov 8, 2002, 7:19:26 PM11/8/02
to
Mike:

Take a look at the post by Michael Wisely "Internet File
Download..." about an hour earlier than yours.


--
PC Datasheet
A Resource for Access, Excel and Word Applications
reso...@pcdatasheet.com
www.pcdatasheet.com

· Design and basic development for new applications
· Additions, Modifications and "Fixes" for existing applications
· Mentoring for do-it-yourselfers who want guidance
· Complete application design and development
· Applications Using Palm Pilot To Collect Data And
Synchronize The Data Back To Access Or Excel

"Mike Hnatt" <do...@gladstone-inc.com> wrote in message
news:usoih2o...@corp.supernews.com...

Mike Hnatt

unread,
Nov 9, 2002, 3:07:52 AM11/9/02
to
Yes, but that is the same one that I mentioned by "Dev" Ashish (see my post
and the subject heading). It only works on a few select servers.

"PC Datasheet" <reso...@pcdatasheet.com> wrote in message
news:iwYy9.17$Mc...@tornadotest1.news.pas.earthlink.net...
: Mike:

: >
: >
: >
: >
:
:


Lyle Fairfield

unread,
Nov 9, 2002, 4:06:20 AM11/9/02
to
"Mike Hnatt" <do...@gladstone-inc.com> wrote in
news:uspgitg...@corp.supernews.com:

> Yes, but that is the same one that I mentioned by "Dev" Ashish (see my
> post and the subject heading). It only works on a few select servers.

Mine:

' this is a class definition

Option Explicit

Private Const INTERNET_ERROR_BASE As Long = 12000
Private Const ERROR_FTP_TRANSFER_IN_PROGRESS As Long = INTERNET_ERROR_BASE
+ 110 Private Const ERROR_FTP_DROPPED As Long = INTERNET_ERROR_BASE + 111
Private Const ERROR_FTP_NO_PASSIVE_MODE As Long = INTERNET_ERROR_BASE +
112 Private Const ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED As Long =
INTERNET_ERROR_BASE + 44 Private Const ERROR_INTERNET_INCORRECT_PASSWORD =
INTERNET_ERROR_BASE + 14 Private Const ERROR_INVALID_HANDLE As Long = 6
Private Const ERROR_NO_ERROR As Long = 0
Private Const ERROR_NO_MORE_FILES As Long = 18
Private Const ERROR_SUCCESS As Long = ERROR_NO_ERROR
Private Const FILE_ATTRIBUTE_ARCHIVE As Long = &H20
Private Const FILE_ATTRIBUTE_COMPRESSED As Long = &H800
Private Const FILE_ATTRIBUTE_DIRECTORY As Long = &H10
Private Const FILE_ATTRIBUTE_HIDDEN As Long = &H2
Private Const FILE_ATTRIBUTE_NORMAL As Long = &H80
Private Const FILE_ATTRIBUTE_OFFLINE As Long = &H1000
Private Const FILE_ATTRIBUTE_READONLY As Long = &H1
Private Const FILE_ATTRIBUTE_SYSTEM As Long = &H4
Private Const FILE_ATTRIBUTE_TEMPORARY As Long = &H100
Private Const FLAGS_ERROR_UI_FILTER_FOR_ERRORS As Long = &H1
Private Const FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS As Long = &H2
Private Const FLAGS_ERROR_UI_FLAGS_GENERATE_DATA As Long = &H4
Private Const FLAGS_ERROR_UI_FLAGS_NO_UI As Long = &H8
Private Const FLAGS_ERROR_UI_SERIALIZE_DIALOGS As Long = &H10
Private Const FTP_TRANSFER_TYPE_ASCII As Long = &H1
Private Const FTP_TRANSFER_TYPE_BINARY As Long = &H2
Private Const GENERIC_READ As Long = &H80000000
Private Const GENERIC_WRITE As Long = &H40000000
Private Const INTERNET_DEFAULT_FTP_PORT As Long = 21
Private Const INTERNET_DEFAULT_GOPHER_PORT As Long = 70
Private Const INTERNET_DEFAULT_HTTP_PORT As Long = 80
Private Const INTERNET_DEFAULT_HTTPS_PORT As Long = 443
Private Const INTERNET_DEFAULT_SOCKS_PORT As Long = 1080
Private Const INTERNET_FLAG_RESYNCHRONIZE As Long = &H800
Private Const INTERNET_FLAG_HYPERLINK As Long = &H400
Private Const INTERNET_FLAG_NO_UI As Long = &H200
Private Const INTERNET_FLAG_PRAGMA_NOCACHE As Long = &H100
Private Const INTERNET_FLAG_CACHE_ASYNC As Long = &H80
Private Const INTERNET_FLAG_FORMS_SUBMIT As Long = &H40
Private Const INTERNET_FLAG_NEED_FILE As Long = &H10
Private Const INTERNET_FLAG_MUST_CACHE_REQUEST As Long =
INTERNET_FLAG_NEED_FILE Private Const INTERNET_FLAG_KEEP_CONNECTION As
Long = &H400000 Private Const INTERNET_FLAG_MULTIPART As Long = &H200000
Private Const INTERNET_FLAG_PASSIVE As Long = &H8000000
Private Const INTERNET_FLAG_RELOAD As Long = &H80000000
Private Const INTERNET_INVALID_PORT_NUMBER As Long = 0
Private Const INTERNET_OPEN_TYPE_DIRECT As Long = 1
Private Const INTERNET_OPEN_TYPE_PRECONFIG As Long = 0
Private Const INTERNET_OPEN_TYPE_PROXY As Long = 3
Private Const INTERNET_OPTION_CONNECT_TIMEOUT As Long = 2
Private Const INTERNET_OPTION_PASSWORD As Long = 29
Private Const INTERNET_OPTION_PROXY_PASSWORD As Long = 44
Private Const INTERNET_OPTION_PROXY_USERNAME As Long = 43
Private Const INTERNET_OPTION_RECEIVE_TIMEOUT As Long = 6
Private Const INTERNET_OPTION_SEND_TIMEOUT As Long = 5
Private Const INTERNET_OPTION_USERNAME As Long = 28
Private Const INTERNET_OPTION_VERSION As Long = 40
Private Const INTERNET_SERVICE_FTP As Long = 1
Private Const INTERNET_SERVICE_GOPHER As Long = 2
Private Const INTERNET_SERVICE_HTTP As Long = 3
Private Const MAX_PATH As Long = 260

Private Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type

Private Type WIN32_FIND_DATA
dwFileAttributes As Long
ftCreationTime As FILETIME
ftLastAccessTime As FILETIME
ftLastWriteTime As FILETIME
nFileSizeHigh As Long
nFileSizeLow As Long
dwReserved0 As Long
dwReserved1 As Long
cFileName As String * MAX_PATH
cAlternate As String * 14
End Type

Private Declare Function FtpCreateDirectory Lib "wininet.dll" Alias
"FtpCreateDirectoryA" _
(ByVal hFtpSession As Long, ByVal strFilename As String) As Boolean

Private Declare Function FtpDeleteFile Lib "wininet.dll" Alias
"FtpDeleteFileA" _
(ByVal hFtpSession As Long, ByVal strFilename As String) As Boolean

Private Declare Function FtpFindFirstFile Lib "wininet.dll" Alias
"FtpFindFirstFileA" _
(ByVal hFtpSession As Long, ByVal strSearchFile As String, _
lpFindFileData As WIN32_FIND_DATA, ByVal dwFlags As Long, _
ByVal dwContent As Long) As Long

Private Declare Function FtpGetCurrentDirectory Lib "wininet.dll" Alias
"FtpGetCurrentDirectoryA" _
(ByVal hFtpSession As Long, ByVal strDirectoryName As String,
lngLengthBuffer As Long) As Boolean

Private Declare Function FtpGetFile Lib "wininet.dll" Alias "FtpGetFileA"
_
(ByVal hFtpSession As Long, ByVal strRemoteFile As String, _
ByVal strNewFile As String, ByVal fFailIfExists As Boolean, _
ByVal dwFlagsAndAttributes As Long, ByVal dwFlags As Long, _
ByVal dwContext As Long) As Boolean

Private Declare Function FtpGetFileSize Lib "wininet.dll" _
(ByVal hOpenFileHandle As Long, lngFileSize As Long) As Long

Private Declare Function FtpOpenFile Lib "wininet.dll" Alias
"FtpOpenFileA" _
(ByVal hFtpSession As Long, ByVal strFilename As String, _
ByVal lAccess As Long, ByVal lFlags As Long, _
ByVal lContext As Long) As Long

Private Declare Function FtpPutFile Lib "wininet.dll" Alias "FtpPutFileA"
_
(ByVal hFtpSession As Long, ByVal strLocalFile As String, _
ByVal strRemoteFile As String, _
ByVal dwFlags As Long, ByVal dwContext As Long) As Boolean

Private Declare Function FtpRemoveDirectory Lib "wininet.dll" Alias
"FtpRemoveDirectoryA" _
(ByVal hFtpSession As Long, ByVal strFilename As String) As Boolean

Private Declare Function FtpSetCurrentDirectory Lib "wininet.dll" Alias
"FtpSetCurrentDirectoryA" _
(ByVal hFtpSession As Long, ByVal strDirectoryName As String) As
Boolean

Private Declare Function InternetCloseHandle Lib "wininet.dll" _
(ByVal hInet As Long) As Integer

Private Declare Function InternetConnect Lib "wininet.dll" Alias
"InternetConnectA" _
(ByVal hInternetSession As Long, ByVal strServerName As String, _
ByVal intServerPort As Integer, ByVal strUserName As String, _
ByVal strPassWord As String, ByVal lngService As Long, _
ByVal lngFlags As Long, ByVal lngContext As Long) As Long

Private Declare Function InternetErrorDlg Lib "wininet.dll" _
(hWnd As Long, ByVal hInternet As Long, _
ByVal lngError As Long, ByVal lngFlags As Long, Optional lngStruc As
Long) As Long

Private Declare Function InternetFindNextFile Lib "wininet.dll" Alias
"InternetFindNextFileA" _
(ByVal hFoundFile As Long, lpFindFileData As WIN32_FIND_DATA) As
Boolean

Private Declare Function InternetGetLastResponseInfo Lib "wininet.dll" _
Alias "InternetGetLastResponseInfoA" _
(lngError As Long, _
ByVal strBuffer As String, _
lngBufferLength As Long) As Boolean

Private Declare Function InternetOpen Lib "wininet.dll" Alias
"InternetOpenA" _
(ByVal strAgent As String, ByVal lngAccessType As Long, _
ByVal strProxyName As String, ByVal strProxyBypass As String, _
ByVal lngFlags As Long) As Long

Private Declare Function InternetReadFile Lib "wininet.dll" _
(ByVal hFtpSession As Long, ByVal strBuffer As String, _
ByVal lngLengthBuffer As Long, lngBytesRead As Long) As Boolean

Private Declare Function InternetWriteFile Lib "wininet.dll" _
(ByVal hFtpSession As Long, ByVal strBuffer As String, _
ByVal lngLengthBuffer As Long, lngBytesWritten As Long) As Boolean

Private Declare Function GetDesktopWindow Lib "user32" () As Long

Private Declare Function GetLastError Lib "kernel32" () As Long

Dim mHInternet As Long
Dim mHConnect As Long
Dim mHFoundFile As Long
Dim mHOpenFile As Long

Dim mBooFailIfExists As Boolean

Dim mStrDirectoryName As String
' as Genealogy/DynamicTree/Families
Dim mStrFindFileName As String
Dim mStrDeleteFileName As String
Dim mStrDownLoadFileName As String
Dim mStrNewDownLoadFileName As String
Dim mStrNewUpLoadFileName As String
Dim mStrPassWord As String
Dim mStrUpLoadFileName As String
Dim mStrReadBuffer As String
Dim mStrReadFileName As String
Dim mStrServerName As String
' as ftp.cyriv.com
Dim mStrUserName As String
Dim mStrWriteBuffer As String
Dim mStrWriteFileName As String
Dim mWFD As WIN32_FIND_DATA

Private Sub Class_Initialize()
mHInternet = InternetOpen("Microsoft Access",
INTERNET_OPEN_TYPE_DIRECT, _
vbNullString, vbNullString, 0)
If mHInternet = 0 Then
MsgBox "Could not open Internet Connection", vbCritical, "FTP"
Class_Terminate
End If
End Sub

Private Sub Class_Terminate()
InternetCloseHandle mHOpenFile
InternetCloseHandle mHFoundFile
InternetCloseHandle mHConnect
InternetCloseHandle mHInternet
End Sub

' ****
' Lets
' ****

Public Property Let DeleteFileName(ByVal vStrDeleteFileName As String)
mStrDeleteFileName = vStrDeleteFileName
AddNullChar mStrDeleteFileName
End Property

Public Property Let DirectoryName(ByVal vStrDirectoryName)
mStrDirectoryName = vStrDirectoryName
End Property

Public Property Let DownloadFileName(ByVal vStrDownLoadFileName As String)
mStrDownLoadFileName = vStrDownLoadFileName
AddNullChar mStrDownLoadFileName
End Property

Public Property Let FailIfExists(ByVal vBooFailIfExists As Boolean)
mBooFailIfExists = vBooFailIfExists
End Property

Public Property Let FindFileName(ByVal vStrFindFileName As String)
mStrFindFileName = vStrFindFileName
End Property

Public Property Let NewDownLoadFileName(ByVal vStrNewDownLoadFileName As
String)
mStrNewDownLoadFileName = vStrNewDownLoadFileName
End Property

Public Property Let NewUpLoadFileName(ByVal vStrNewUpLoadFileName As
String)
mStrNewUpLoadFileName = vStrNewUpLoadFileName
AddNullChar mStrNewUpLoadFileName
End Property

Public Property Let PassWord(ByVal vStrPassWord As String)
mStrPassWord = vStrPassWord
End Property

Public Property Let ReadFileName(ByVal vStrReadFileName As String)
mStrReadFileName = vStrReadFileName
End Property

Public Property Let UpLoadFileName(ByVal vStrUpLoadFileName As String)
mStrUpLoadFileName = vStrUpLoadFileName
End Property

Public Property Let UserName(ByVal vStrUserName As String)
mStrUserName = vStrUserName
End Property

Public Property Let WriteFileName(ByVal vStrWriteFileName As String)
mStrWriteFileName = vStrWriteFileName
End Property

Public Property Let WriteBuffer(ByVal vStrWriteBuffer As String)
mStrWriteBuffer = vStrWriteBuffer
End Property

Public Property Let ServerName(ByVal vStrServerName As String)
mStrServerName = vStrServerName
End Property

' ****
' Gets
' ****

Public Property Get DeleteFile() As Boolean
DeleteFile = FtpDeleteFile(mHConnect, mStrDeleteFileName)
End Property

Public Property Get DownLoadFile() As Boolean
DownLoadFile = FtpGetFile(mHConnect, mStrDownLoadFileName,
mStrNewDownLoadFileName, mBooFailIfExists, 0, 0, 0)
End Property

Public Property Get FindFirstFile() As Long
FindFirstFile = FtpFindFirstFile(mHConnect, mStrFindFileName, mWFD, 0,
0) If GetLastError() And ERROR_FTP_TRANSFER_IN_PROGRESS Then
InternetCloseHandle mHConnect
FindFirstFile = FtpFindFirstFile(mHConnect, mStrFindFileName,
mWFD, 0, 0)
End If
InternetCloseHandle mHFoundFile
mHFoundFile = FindFirstFile
End Property

Public Property Get FindNextFile() As Boolean
FindNextFile = InternetFindNextFile(mHFoundFile, mWFD)
If FindNextFile = 0 Then
If GetLastError() = ERROR_NO_MORE_FILES Then _
MsgBox "No More Files!", vbInformation, "FTP"
End If
End Property

Public Property Get FoundFileName() As String
FoundFileName = mWFD.cFileName
StripNullChar FoundFileName
End Property

Public Property Get GetCurrentDirectory() As String
Dim strBuffer As String
Dim lngBufferLength As Long
lngBufferLength = MAX_PATH
strBuffer = String(lngBufferLength - 1, " ")
If FtpGetCurrentDirectory(mHConnect, strBuffer, lngBufferLength) <> 0
Then
GetCurrentDirectory = Left(strBuffer, lngBufferLength)
End If
End Property

Public Property Get GetFileSize() As Long
GetFileSize = FtpGetFileSize(mHOpenFile, GetFileSize)
End Property

Public Property Get IsConnected() As Boolean
IsConnected = CBool(mHConnect)
End Property

Public Property Get OpenForRead() As Boolean
InternetCloseHandle mHOpenFile
mHOpenFile = FtpOpenFile(mHConnect, mStrReadFileName, GENERIC_READ,
FTP_TRANSFER_TYPE_BINARY, 0) OpenForRead = (mHOpenFile <> 0)
End Property

Public Property Get OpenForWrite() As Boolean
InternetCloseHandle mHOpenFile
mHOpenFile = FtpOpenFile(mHConnect, mStrWriteFileName, GENERIC_WRITE,
FTP_TRANSFER_TYPE_BINARY, 0) OpenForWrite = (mHOpenFile <> 0)
End Property

Public Property Get ReadBuffer()
ReadBuffer = mStrReadBuffer
End Property

Public Property Get ReadFromFile() As Long
Dim booRead As Boolean
Dim strReadBuffer As String
Dim lngReadBufferLength As Long
Dim lngBytesRead As Long
On Error GoTo ReadToFileErr
strReadBuffer = String(GetFileSize, " ") & vbNullChar
lngReadBufferLength = Len(strReadBuffer)
Do
booRead = InternetReadFile(mHOpenFile, strReadBuffer, _
lngReadBufferLength, lngBytesRead)
ReadFromFile = ReadFromFile + lngBytesRead
mStrReadBuffer = mStrReadBuffer & Left(strReadBuffer,
lngBytesRead)
Loop Until lngBytesRead = 0 Or booRead = False
ReadToFileExit:
InternetCloseHandle mHOpenFile
Exit Property
ReadToFileErr:
Resume ReadToFileExit
End Property

Public Property Get SetCurrentDirectory() As Boolean
SetCurrentDirectory = (FtpSetCurrentDirectory(mHConnect,
mStrDirectoryName) <> 0)
End Property

Public Property Get UploadFile() As Boolean
UploadFile = FtpPutFile(mHConnect, mStrUpLoadFileName,
mStrNewUpLoadFileName, FTP_TRANSFER_TYPE_BINARY, 0)
End Property

Public Property Get WriteToFile() As Long
Dim booWrite As Boolean
Dim lngWriteBufferLength As Long
On Error GoTo WriteToFileExit
lngWriteBufferLength = Len(mStrWriteBuffer)
InternetWriteFile mHOpenFile, ByVal mStrWriteBuffer, _
lngWriteBufferLength, WriteToFile
WriteToFileExit:
InternetCloseHandle mHOpenFile
Exit Property
WriteToFileErr:
Resume WriteToFileExit
End Property

' ****
' subs
' ****

Public Sub ConnectToServer()
InternetCloseHandle mHConnect
mHConnect = InternetConnect(mHInternet, _
mStrServerName, _
INTERNET_DEFAULT_FTP_PORT, _
mStrUserName, _
mStrPassWord, _
INTERNET_SERVICE_FTP, 0, 0)
End Sub

Public Sub ShowLastResponseInfo()
Dim lngError As Long
Dim strError As String
Dim strBuffer As String
Dim lngBufferLength As Long
strBuffer = String(2047, " ") & vbNullChar
lngBufferLength = 2048
If InternetGetLastResponseInfo(lngError, strBuffer, lngBufferLength) =
0 Then
MsgBox "Last response information could not be read!",
vbInformation, "FTP"
Else
If lngError <> 0 Then strError = " Error " & lngError
If lngBufferLength <> 0 Then _
MsgBox Left(strBuffer, lngBufferLength), vbInformation, "FPT" &
strError
End If
End Sub


' ***********
' auxiliaries
' ***********

Private Sub AddNullChar(ByRef s As String)
If Right(s, 1) <> vbNullChar Then s = s & vbNullChar
End Sub

Private Sub StripNullChar(ByRef s As String)
Dim p As Long
p = InStr(s, vbNullChar)
If p <> 0 Then s = Left(s, p - 1)
End Sub

' end of class defintion

************
* calling as
************
Dim cFTP As clsFTP
Set cFTP = New clsFTP

If Not gCancelFTP Then
With cFTP
.ServerName = DBEngine(0)(0).Properties("ServerName")
If Not .IsConnected Then
DoCmd.OpenForm "frmLogon", acNormal, , , acFormEdit, acDialog
End If
.UserName = gUserName
.PassWord = gPassWord
.ConnectToServer
If .IsConnected Then
strFTPDirectory = DBEngine(0)(0).Properties("FamiliesFTP")
AC97Replace strFTPDirectory, "\", 1, "/"
If Left(strFTPDirectory, 1) <> "/" Then strFTPDirectory = "/"
& strFTPDirectory Do While Right(strFTPDirectory, 1) = "/"
strFTPDirectory = Left(strFTPDirectory,
Len(strFTPDirectory) - 1) If Len(strFTPDirectory) = 0 Then
Exit Do
Loop
.DirectoryName = strFTPDirectory
If .SetCurrentDirectory Then
booCanFTP = True
Else
.ShowLastResponseInfo
End If
Else
.ShowLastResponseInfo
End If
End With
End If

If booCanFTP Then
With cFTP
FileName strHTMPath
.WriteFileName = strHTMPath
.WriteBuffer = Stream
If .OpenForWrite Then
lngBytesWritten = .WriteToFile
If lngBytesWritten <> 0 Then
lngFilesUploaded = lngFilesUploaded + 1
Else
.ShowLastResponseInfo
End If
Else
.ShowLastResponseInfo
End If
End With
End If

Set cFTP = Nothing

well ... it's a bit old ... but it seemed to work on several servers

unfortunately word wrap will be a problem here ... but since attachments
are banned ...

--
Lyle

Dev Ashish

unread,
Nov 9, 2002, 6:35:42 AM11/9/02
to
"Mike Hnatt" <do...@gladstone-inc.com> wrote in message
> It only works on a few select servers.

Lyle has already posted an alternative solution, but to be honest, your
message is not very helpful as it does not contain what specific errors you
received, the FTP server connection info, etc. If you expect help, then
please provide the necessary details. FWIW, the page you referenced has been
online for a couple of years, and the code has been tested by quite a few
folks.

--
Dev Ashish
Access MVP
http://www.mvps.org/access; http://www.mvps.org/accessfr


John Winterbottom

unread,
Nov 9, 2002, 9:43:09 AM11/9/02
to

"Mike Hnatt" <do...@gladstone-inc.com> wrote in message
news:usoih2o...@corp.supernews.com...

I use ASPupload and XUpload from Persists software - very happy with both of
them and they support passive transfers, HTTP transfer, progress meter. You
can get a trial version from http://www.persists.com


tony summerfelt

unread,
Nov 13, 2002, 12:43:33 PM11/13/02
to
On Sat, 09 Nov 2002 at 11:35 GMT, Dev Ashish <das...@hotmail.com> wrote:

> online for a couple of years, and the code has been tested by quite a few
> folks.

inetTransferLib is only for access97 ?

i've upgraded to access 2002, and i'm finding that a good number of add-ins,
etc. haven't been upgraded (or don't work on) access 2002.

i'm still amazed at the quality of the free tools and add-ins available for
access. i include a 'credits' form with every one of the access applications
i write that are dependant on third party code.

--
http://home.cogeco.ca/~tsummerfelt1

Katie M

unread,
Nov 13, 2002, 12:59:15 PM11/13/02
to

"Dev Ashish" <das...@hotmail.com> wrote in message
news:aqirvq$a9bcq$1...@ID-14345.news.dfncis.de...

> "Mike Hnatt" <do...@gladstone-inc.com> wrote in message
> > It only works on a few select servers.
>
> Lyle has already posted an alternative solution, but to be honest, your
> message is not very helpful as it does not contain what specific errors
you
> received, the FTP server connection info, etc. If you expect help, then
> please provide the necessary details. FWIW, the page you referenced has
been
> online for a couple of years, and the code has been tested by quite a few
> folks.

Hi Dev,
He may be referring to the problem I asked about some months ago. Here is
the content of the original post; please let me know if you have any
questions.
---Begin Original Post---
Hi,
I have an Access 2k database, which I'm trying to program to upload to a
server via FTP. I've imported the FTP and cDialog classes from the
InetTransferLib.mda file by Dev Ashish and Terry Creft (Microsoft's Inet
control doesn't work for my purposes).

I've seen questions similar to this on the newsgroups before, but no
answers, where the code apparently doesn't work if you want to upload to
a server location that's further down than one directory. Is this a
known bug? If so, is there a fix? Thanks :)

The error message is this:
UploadToServer: #-2147219289
200 Type set to I.
227 Entering Passive Mode (<IP address>,17,148)
550 /Htdocs/extranet/members/uploads/InetTransferLib.mda: The system
cannot find the path specified.

The error is raised by the following line of code in the FTP class
module:
--Begin Code--
lngRet = apiFTPPutFile(hSession, mstrSrcFile, mstrDestination, _
INTERNET_FLAG_TRANSFER_BINARY Or INTERNET_FLAG_NO_CACHE_WRITE, 0&)
If lngRet = 0 Then Err.Raise conERR_COULD_NOT_TRANSFER_FILE
--End Code--

(The "If lngRet=0" condition is True)

Related variables:
hSession=13369352
mstrSourceFile="C:\Work\InetTransferLib.mda"
strDestination="/Htdocs/extranet/members/uploads/InetTransferLib.mda"
INTERNET_FLAG_TRANSFER_BINARY=2
INTERNET_FLAG_NO_CACHE_WRITE=67108864

Constants and variables called by my code are as follows:
Global constants:
Global Const csFTPServerIP = "<the IP>"
Global Const csFTPUploadLoc = "/Htdocs/extranet/members/uploads"
Global Const csFTPUserName = "<the username>"
Global Const csFTPPassword = "<the password>"

Other:
txtOriginalStorageLocation.Value = C:\Work\InetTransferLib.mda

..And here's my code:
---Begin Code---
Private Sub cmdUploadToServer_Click()
Dim strFileName As String, strFileTitle As String

'Check that there is a local file location
<snipped code that exits sub if condition is false>

'Check that the file provided at the local file location
'exists
<snipped code that exits sub if condition is false>

'Confirm upload
<snipped code that exits sub if condition is false>

'Set FileName (=Full path of local file) and FileTitle
'(=Just the name of the file, without path) variables
strFileName = txtOriginalStorageLocation.Value
strFileTitle = Right(strFileName, _
Len(strFileName) - InStrRev(strFileName, "\"))

'Upload to server
Call UploadToServer(strFileName, strFileTitle)

'Check Uploaded checkbox
chkOnWebServer.Value = True
End Sub

Public Sub UploadToServer(strFileName As String, _
strFileTitle As String)
'Parameters:
' strFileName - directory path and file name of local
' file
' strFileTitle - file name, without path information

Dim objFTP As New FTP

With objFTP
.FtpURL = "ftp://" & csFTPServerIP

.SourceFile = strFileName
.DestinationFile = csFTPUploadLoc & "/" & strFileTitle
.AutoCreateRemoteDir = False
'If Not .IsConnected Then .DialDefaultNumber
.ConnectToFTPHost csFTPUserName, csFTPPassword
.UploadFileToFTPServer
End With
End Sub
---End Code---

Many thanks!
Katie
---End Original Post---

~~~~~~~~~~
Katie M
I hail from yahoo.com.
My handle is Katerine
Do not email me unless it's about something I posted.


Dev Ashish

unread,
Nov 13, 2002, 2:52:32 PM11/13/02
to
That's correct, based on how the utility was originally written. You can
either import all the classes to your own db, and drop the
'InetTransferLib.' prefix, or use the beta version (in the form of a VB6
dll), I haven't had a chance to finish the release docs yet.

[ http://www.mvps.org/access/downloads/InternetTransferLib.zip ]


"tony summerfelt" <snow...@hotmail.com> wrote in message
news:9bwA9.13758$lj.3...@read1.cgocable.net...

Dev Ashish

unread,
Nov 13, 2002, 2:56:35 PM11/13/02
to
No, the code works as long as the path is correct. I've tested it several
times myself. Couple of possibilities:

a) After login, the server puts you in a 'home' directory from which you
can't navigate to the path specified.

b) Since AutoCreateRemoteDir is set to false, it's possible that the folder
doesn't exist.

Can you try logging in to the site from console's FTP.exe, then changing
folders with 'cd' to the location you are using and post back any
errors/results you get out of it?

You can also try a different version (no release docs yet, but the tester
exe has a mini-FTP client in it which might make this easier to debug
visually)

[ http://www.mvps.org/access/downloads/InternetTransferLib.zip ]


"Katie M" <nos...@seemysig.net> wrote in message
news:ut54n8g...@corp.supernews.com...
>
> ---Begin Original Post---


>
> I've seen questions similar to this on the newsgroups before, but no
> answers, where the code apparently doesn't work if you want to upload to
> a server location that's further down than one directory.
>

> The error message is this:
> UploadToServer: #-2147219289
> 200 Type set to I.
> 227 Entering Passive Mode (<IP address>,17,148)
> 550 /Htdocs/extranet/members/uploads/InetTransferLib.mda: The system
> cannot find the path specified.

<snip>


> Related variables:
> hSession=13369352
> mstrSourceFile="C:\Work\InetTransferLib.mda"
> strDestination="/Htdocs/extranet/members/uploads/InetTransferLib.mda"
> INTERNET_FLAG_TRANSFER_BINARY=2
> INTERNET_FLAG_NO_CACHE_WRITE=67108864
>
> Constants and variables called by my code are as follows:
> Global constants:
> Global Const csFTPServerIP = "<the IP>"
> Global Const csFTPUploadLoc = "/Htdocs/extranet/members/uploads"
> Global Const csFTPUserName = "<the username>"
> Global Const csFTPPassword = "<the password>"

<snip>


tony summerfelt

unread,
Nov 14, 2002, 11:25:37 AM11/14/02
to
On Wed, 13 Nov 2002 at 19:52 GMT, Dev Ashish <das...@hotmail.com> wrote:

> That's correct, based on how the utility was originally written. You can
> either import all the classes to your own db, and drop the

> dll), I haven't had a chance to finish the release docs yet.

i'll be waiting for the new release

until then...

> [ http://www.mvps.org/access/downloads/InternetTransferLib.zip ]

thanks...

--
http://home.cogeco.ca/~tsummerfelt1

0 new messages