I am using xampp on Windows and want to upload an file via ftp.exe. I created a .vbs script creating an ftp.dat file and run ftp.exe.
Set FS = CreateObject("Scripting.FileSystemObject")
Set FileIn = fs.OpenTextFile("C:\xampp\htdocs\ftp.dat", 2, true)
filein.WriteLine "open"
filein.WriteLine "IP"
filein.WriteLine "USER"
filein.WriteLine "PASSWORD"
filein.WriteLine "put C:\path\to\file\file.txt"
filein.WriteLine "quit"
filein.close
Set WSHShell = WScript.CreateObject("WScript.Shell")
WshShell.run "cmd /c ftp.exe -s:C:\xampp\htdocs\ftp.dat > log"
I printed the output to a log file giving me this error:
ftp> To Connected to XXX.XXX.XXX.XXX.
open
XXX.XXX.XXX.XXX
220 hostname FTP server ready.
User (XXX.XXX.XXX.XXX:(none)):
331 Password required for USER.
230 User USER logged in.
ftp> put C:\path\to\file\file.txt
200 PORT command successful.
553 file.txt: Permission denied.
ftp> quit
221 Goodbye. You uploaded 0 bytes and downloaded 0 bytes.
When I run this .vbs file in the command line, everything works fine. But if I run this using exec/system I get the error from above.
PHP File:
<? php
exec('C:\\xampp\htdocs\\upload.vbs');
?>