I posted an article many ages ago which does (I think) exactly what you want:
http://www.howtogeek.com/50359/upload-files-to-an-ftp-site-via-a-batch-script/
This script takes in a file name as a parameter or you can specify a text file which contains a listing of files to upload. The latter option can be useful if you need to upload files matching a certain criteria (just write DIR
output to a text file and supply the text file as the parameter).
If nothing else, it should provide a working example of how to use the built in FTP command.
Here is the script from the link above:
@ECHO OFF
REM Usage -- save this script as "UploadToFTP.bat":
REM UploadToFTP [/L] FileToUpload
REM
REM Required Parameters:
REM FileToUpload
REM The file or a text file containing the list of files to be uploaded.
REM
REM Optional Parameters:
REM /L When supplied, the FileToUpload is read as a list of files to be uploaded.
REM A list of files should be a plain text file which has a single file on each line.
REM Files listed in this file must specify the full path.
SETLOCAL EnableExtensions
REM Connection information:
SET Server=
SET UserName=
SET Password=
REM ---- Do not modify anything below this line ----
SET Commands="%TEMP%SendToFTP_commands.txt"
REM FTP user name and password. No spaces after either.
ECHO %UserName%> %Commands%
ECHO %Password%>> %Commands%
REM FTP transfer settings.
ECHO binary >> %Commands%
IF /I "%~1"=="/L" (
REM Add file(s) to the list to be FTP'ed.
FOR /F "usebackq tokens=*" %%I IN ("%~dpnx2") DO ECHO put "%%~I" >> %Commands%
) ELSE (
ECHO put "%~dpnx1" >> %Commands%
)
REM Close the FTP connection.
ECHO close >> %Commands%
ECHO bye >> %Commands%
REM Perform the FTP.
FTP -d -i -s:%Commands% %Server%
ECHO.
ECHO.
REM Clean up.
IF EXIST %Commands% DEL %Commands%
ENDLOCAL