FTP Upload with space in filename
Posted: Sat Sep 07, 2024 8:38 am
This code works fine in Windows, unfortunately NOT in Linux (Ubuntu, Mint)
Does anyone have an idea how to do this in Linux?
Does anyone have an idea how to do this in Linux?
Code: Select all
EnableExplicit
Declare ftptest()
ftptest()
Procedure ftptest()
Protected connect,change,success,gesuccesst
Protected.s exepath,source,target,file
exepath=GetPathPart(ProgramFilename())
connect= OpenFTP(#PB_Any, "sftp://myserver.com", "myName", "MyPassword")
If connect>0
Debug "successfully connected"
Debug GetFTPDirectory(connect)
change = SetFTPDirectory(connect, "pictures")
Debug GetFTPDirectory(connect)
file="my file.jpg"
source=exepath+"userbilder/"+file
target=file
;target=chr(34)+target+chr(34) ;doesn't work in Linux
;target=chr(34)+chr(34)+target+chr(34)+chr(34) ;doesn't work in Linux
Debug "from "+source+" to "+target
If FileSize(source)>0
Debug source+" found"
success = SendFTPFile(connect, source, target)
If success>0
Debug "success"
Else
Debug "NO success"
EndIf
EndIf
CloseFTP(connect)
Else
Debug "No connection possible."
EndIf
EndProcedure