Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File uploading problem

Status
Not open for further replies.

vcherubini

Programmer
May 29, 2000
527
US
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 != &quot;myusername&quot;) &amp;&amp; ($pass != &quot;mypassword&quot;)) {
print &quot;you have entered the wrong password. go back and try again.\n&quot;;
} else {
$ftp_server = &quot;216.36.253.145&quot;;

$conn_id = ftp_connect(&quot;$ftp_server&quot;);

$login_result = ftp_login(&quot;$conn_id&quot;, &quot;$user&quot;, &quot;$pass&quot;);

if ((!$conn_id) || (!$login_result)) {
echo &quot;Ftp connection has failed!<br>&quot;;
echo &quot;Attempted to connect to $ftp_server for user $user&quot;;
die;
} else {
echo &quot;Connected to $ftp_server, for user $user<br>&quot;;
}

$chdir = ftp_chdir($conn_id,&quot; if (!$chdir) {
print &quot;failed to change directory.<br>\n&quot;;
} else {
print &quot;directory changed.<br>\n&quot;;
$dir = finddir($conn_id);
print &quot;$dir\n&quot;;

}
//$dir = finddir($conn_id);
//print &quot;$dir\n&quot;;

$upload = ftp_put($conn_id, &quot;$destination_file&quot;, &quot;$source_file&quot;, FTP_ASCII);

if (!$upload) {
echo &quot;Ftp upload has failed!&quot;;
} else {
echo &quot;Uploaded $source_file to $ftp_server as $destination_file&quot;;
}

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
====
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top