vcherubini
Programmer
Hello:
I wrote a little script here that uploads a file to my server. My server is a Linux server while my computer is Windows.
Here is the script:
[tt]
<?php
if (($user != "myusername" && ($pass != "mypassword") {
print "you have entered the wrong password. go back and try again.\n";
} else {
$ftp_server = "216.36.253.145";
$conn_id = ftp_connect("$ftp_server"
$login_result = ftp_login("$conn_id", "$user", "$pass"
if ((!$conn_id) || (!$login_result)) {
echo "Ftp connection has failed!<br>";
echo "Attempted to connect to $ftp_server for user $user";
die;
} else {
echo "Connected to $ftp_server, for user $user<br>";
}
$chdir = ftp_chdir($conn_id," if (!$chdir) {
print "failed to change directory.<br>\n";
} else {
print "directory changed.<br>\n";
$dir = finddir($conn_id);
print "$dir\n";
}
//$dir = finddir($conn_id);
//print "$dir\n";
$upload = ftp_put($conn_id, "$destination_file", "$source_file", FTP_ASCII);
if (!$upload) {
echo "Ftp upload has failed!";
} else {
echo "Uploaded $source_file to $ftp_server as $destination_file";
}
ftp_quit($conn_id);
}
function finddir($conn) {
return ftp_pwd($conn);
}
?>
[/tt]
When I run it, I receieve the following information:
Connected to 216.36.253.145, for user myusername
directory changed.
/home/cnunited/www
Warning: error opening C:\\WINDOWS\\Desktop\\business.txt in / on line 32
Ftp upload has failed!
Can someone help me with this one?
Thanks in advance,
-Vic vic cherubini
vikter@epicsoftware.com
====
Knows: Perl, HTML, JavScript, C/C++, PHP, Flash, Director
====
I wrote a little script here that uploads a file to my server. My server is a Linux server while my computer is Windows.
Here is the script:
[tt]
<?php
if (($user != "myusername" && ($pass != "mypassword") {
print "you have entered the wrong password. go back and try again.\n";
} else {
$ftp_server = "216.36.253.145";
$conn_id = ftp_connect("$ftp_server"
$login_result = ftp_login("$conn_id", "$user", "$pass"
if ((!$conn_id) || (!$login_result)) {
echo "Ftp connection has failed!<br>";
echo "Attempted to connect to $ftp_server for user $user";
die;
} else {
echo "Connected to $ftp_server, for user $user<br>";
}
$chdir = ftp_chdir($conn_id," if (!$chdir) {
print "failed to change directory.<br>\n";
} else {
print "directory changed.<br>\n";
$dir = finddir($conn_id);
print "$dir\n";
}
//$dir = finddir($conn_id);
//print "$dir\n";
$upload = ftp_put($conn_id, "$destination_file", "$source_file", FTP_ASCII);
if (!$upload) {
echo "Ftp upload has failed!";
} else {
echo "Uploaded $source_file to $ftp_server as $destination_file";
}
ftp_quit($conn_id);
}
function finddir($conn) {
return ftp_pwd($conn);
}
?>
[/tt]
When I run it, I receieve the following information:
Connected to 216.36.253.145, for user myusername
directory changed.
/home/cnunited/www
Warning: error opening C:\\WINDOWS\\Desktop\\business.txt in / on line 32
Ftp upload has failed!
Can someone help me with this one?
Thanks in advance,
-Vic vic cherubini
vikter@epicsoftware.com
====
Knows: Perl, HTML, JavScript, C/C++, PHP, Flash, Director
====