VBA (Access) file upload error: Unable to get local issuer certificate

Advertisement

dbWizard
Joined:
Posts:
10

VBA (Access) file upload error: Unable to get local issuer certificate

I am attempting to run an upload of .txt files from a folder on my computer to my websits /downloads/test folder, via VBA

I have created a subroutine which builds my script and attempts to run it with the following commands:

Dim objShell as object
set objShell = CreateObject("WScript.Shell")
objShell.Run """" & ftpClientApp & """" & " /log=""" & logFile & """" & " /script=""" & scriptFile & """"
'all of that crap converts to:
"C:\Program Files (x86)\WinSCP\WinSCP.exe" /log="C:\Work\ClientFolder\ScriptOutput\WinSCP.log" /script="C:\Work\ClientFolder\ScriptOutput\rad90DD9.tmp"

and the script file looks like:
open ftp://UID:PWD@HostName/ -Explicit
# Change the remote directory
cd /Downloads/Test
# Change the local directory
lcd C:\Work\ClientFolder\SendFiles
# Upload all .txt files from the ftpLocalDir to ftpRemoteDir
put *.txt 
Exit

But I'm getting an error during this process:
Summary: Unable to get local issuer certificate

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
31,243
Location:
Prague, Czechia

Re: VBA (Access) file upload error: Unable to get local issuer certificate

It looks like the server's certificate is not valid.
If you still trust the server, you can use -certificate switch to override that:
open ... -certificate=16:f9:d6:6e:ab:d7:95:4b:ff:c6:ce:b2:c6:8e:22:50:cb:70:7b:61
https://winscp.net/eng/docs/scriptcommand_open#certificate
https://winscp.net/eng/docs/scripting#hostkey

Reply with quote

dale@...
Guest

Certificate

Would I post that specific string of characters, behind the -Certificate argument?

I also noticed, in one of the links you provided, that the -explicit argument is only for use with FTPS protocol, and in this version of the code I'm working on simple FTP, although I will be switching to SFTP or FTPS once I get the simple FTP version working.

When I removed that argument from the code, it looks like I was able to connect, but received another error:

< 2019-04-18 10:48:19.320 Script: /UID/Downloads/Test
> 2019-04-18 10:48:19.320 Script: lcd C:\Work\ClientFolder\SendFiles
< 2019-04-18 10:48:19.506 Script: Too many parameters for command 'lcd'.
. 2019-04-18 10:48:19.507 Script: Failed
. 2019-04-18 10:48:19.507 Script: Exit code: 1
. 2019-04-18 10:48:19.515 Disconnected from server

Note: "ClientFolder" represents a folder that looks like: "\Client Name\2019-04 SFTP\" which does include a space in the first name

Reply with quote

dbWizard
Joined:
Posts:
10

I was able to get this 2nd issue resolved by wrapping the local path (which contains spaces) with quotes.

lcd "C:\Work\Client Folder\SendFiles"

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
31,243
Location:
Prague, Czechia

Re: Certificate

dale@... wrote:

Would I post that specific string of characters, behind the -Certificate argument?
Yes. That's the fingerprint of your server's certificate.

Reply with quote

Advertisement

You can post new topics in this forum