Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
hello all.
Im trying to ftp a .csv using ftp_put() and it is not working. Im getting an error saying that basiacally ftp_put() is returning FALSE.
- "There was a problem while uploading ITS_BLI_05.csv to imports.site_name.com"
My HSP says i have all the right server settings, including an updated *vhost.conf* file. below are my scripts. site_name = whatever.com. Thank for the help.Code: Select all
/******************/
/* VHOST.CONF ********/
/******************/
<Directory "/var/www/vhosts/site_name/httpdocs">
php_admin_value open_basedir "/var/www/vhosts/site_name/httpdocs:/usr/share/pear:/tmp:/var/www/vhosts/site_name/httpdocs/upload:/upload"
php_admin_value safe_mode Off
</Directory>Code: Select all
/******************/
/* MY CODE ********/
/******************/
// SEND DATA TO ITS LOAD BOARD
// Uplaod via FTP to ITS Load Board
// -------------------------------------------
$host = "imports.site_name.com";
$ftp_user_name = 'user_name';
$ftp_user_pass = 'pass_word';
// File name to be given on the $host server
$remote_file = "ITS_BLI_05.csv";
// file location on local server
$file = "/upload/ITS_BLI_05.csv";
$hostip = gethostbyname($host);
$conn_id = ftp_connect($hostip);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// IMPORTANT!!! turn passive mode on
ftp_pasv ( $conn_id, true );
if ((!$conn_id) || (!$login_result)) {
echo "FTP connection has failed!";
echo "Attempted to connect to $host for user $ftp_user_name";
die;
} else {
/* upload a file */
if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) {
echo "successfully uploaded $file<br>";
} else {
echo "There was a problem while uploading $file to $host<br>";
}
// close the connection
ftp_close($conn_id);
}
/******************/
/* end code ********/
/******************/Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]