It may sound stupid... but a similar thing happened to me... try putting quotes around the file you want to put....
Code:
FTPCommandFile = %A_ScriptDir%\FTPCommands.txt
FTPLogFile = %A_ScriptDir%\FTPLog.txt
FileDelete %FTPCommandFile% ; In case previous run was terminated prematurely.
FileAppend,
(
open host.domain.com
username
password
binary
put "%VarContainingNameOfTargetFile%"
quit
), %FTPCommandFile%
RunWait %comspec% /c ftp.exe -s:"%FTPCommandFile%" >"%FTPLogFile%"
FileDelete %FTPCommandFile% ; Delete for security reasons.
Run %FTPLogFile% ; Display the log for review.
notice the quotes on here
put "%VarContainingNameOfTargetFile%"
also.... you did your variable wrong... you need to define the file first... below is a version of the CORRECT code... trust me, it will work.
Code:
FTPCommandFile = %A_ScriptDir%\FTPCommands.txt
FTPLogFile = %A_ScriptDir%\FTPLog.txt
FileDelete %FTPCommandFile% ; In case previous run was terminated prematurely.
fileselectfile, file
FileAppend,
(
open host.domain.com
username
password
binary
put "%file%"
quit
), %FTPCommandFile%
RunWait %comspec% /c ftp.exe -s:"%FTPCommandFile%" >"%FTPLogFile%"
FileDelete %FTPCommandFile% ; Delete for security reasons.
Run %FTPLogFile% ; Display the log for review.