I have the below syntax where I am trying to move a file in my current local server directory onto an FTP server.
$source = $csv_filename;
$target = fopen("/LocExports/test.csv", "w");
$conn = ftp_connect("ftp.server.co.za") or die("Could not connect");
ftp_login($conn,"username","password");
$upload = ftp_put($conn, $target,$source,FTP_ASCII);
if (!$upload) { echo 'FTP upload failed!'; }
This fails with error The parameter is incorrect
$csv_filename
is the name of the file on my local server. it is in the same folder as the php file.
my destination is effectively:
http://www.server.co.za/kisv2/xmltest/
any help would be appreciated.
Thanks as always,
UPDATE
As per alex's advice, here is updated syntax:
$csv_filename = 'export-2013-06-13 15:19:48.csv';
$source = $csv_filename; //this is a file in the same directory as my php file. full path is... http://www.server.co.za/kisv2/xmltest/export-2013-06-13 15:19:48.csv
$target = '/LocExports/'.$csv_filename; //full path is... ftp://ftp.hulamin.co.za/LocExports/
$conn = ftp_connect("ftp.server.co.za") or die("Could not connect");
ftp_login($conn, "username", "password");
$upload = ftp_put($conn, $target, $source, FTP_ASCII);
if (!$upload) { echo 'FTP upload failed!'; }