FTP from Access

  • Thread starter Thread starter J Shrimps, Jr.
  • Start date Start date
J

J Shrimps, Jr.

Download Dev Avish's FTP module
Works fine, but only uploads my
text files in Binary, and I need
them uploaded in ASCII.
How can I change the setting
to upload in ASCII?
 
If you look in the sub UploadFileToFTPServer in the FTP class, you'll notice

lngRet = apiFTPPutFile(hSession, mstrSrcFile, mstrDestination, _
INTERNET_FLAG_TRANSFER_BINARY Or INTERNET_FLAG_NO_CACHE_WRITE, 0&)

The default is actually to use ASCII, so I believe if you remove the
"INTERNET_FLAG_TRANSFER_BINARY Or" from that function call, you should use
ASCII.

There is a parameter INTERNET_FLAG_TRANSFER_ASCII, but they haven't bothered
to define it in the declarations. It would be:

Private Const INTERNET_FLAG_TRANSFER_ASCII = &H1

There's also a section of code in the ConnectToFTPHost sub that may need to
be changed:

hFTP = apiFtpOpenFile(hSession, .lpszUrlPath, _
lngFileMode, FTP_TRANSFER_TYPE_BINARY Or _
INTERNET_FLAG_DONT_CACHE, 0&)

They have defined FTP_TRANSFER_TYPE_ASCII.

For more information, you might check the FTP stuff Randy Birch has at
http://vbnet.mvps.org/code/internet/index.html or what AllApi.Net has at
http://www.mentalis.org/apilist/FtpPutFile.shtml and
http://www.mentalis.org/apilist/6C326855F1AD75EEB82A4D3B16373E9F.html
 
Back
Top