This code showing accsess is denied why?
Posted: Thu Nov 20, 2008 4:17 am
Code: Select all
<?php
// Start the session
header("Cache-control: private"); //IE 6 Fix
$_server = $_POST["server_name"];
$_user_name = $_POST["user_name"];
$_user_pass = $_POST["user_password"];
$local_dir = $_POST["local_dir"];
$remote_dir = $_POST["remote_dir"];
/*
require ("uploadfunctionpage.php");
$uploadfunction = moveFolder($_server, $_user_name, $_user_pass, $local_dir, $remote_dir);
if($uploadfunction=true)
{
echo " successfull";
}
else
{
echo "failed";
}*/
$name = "t.DOC";
$filename = "/WEBROOT/wilbourn/t.DOC";
$destination_file = $remote_dir;
// set up basic connection
$_conn_id = ftp_connect($_server);
// login with username and password
$_login_result = ftp_login($_conn_id, $_user_name, $_user_pass);
// check connection
if ((!$_conn_id) || (!$_login_result)) {
$_error = "FTP connection has failed!";
$_error .= "Attempted to connect to $_server for user $_user_name";
$result = false;
} else {
$_error = "Connected to $_server, for user $_user_name";
}
$conn_id = $_conn_id;
$upload = ftp_put($conn_id, $destination_file.$name, $filename, FTP_BINARY); // upload the file
if (!$upload) { // check upload status
echo "<span style='color:#FF0000'><h2>FTP upload of $filename has failed!</h2></span> <br />";
} else {
echo "<span style='color:#339900'><h2>Uploading $name Completed Successfully!</h2></span><br /><br />";
}
ftp_close($conn_id); // clos
?>