943,724 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 3666
  • PHP RSS
Apr 5th, 2004
0

FTP problem

Expand Post »
Hi - very very new to PHP generally and as usual trying to run before I can walk. I have got the hang of single uploads but now need to use FTP to do multiples. I am now on day 1 of trying to work it out so I am still at silly question stage so please don't laugh. Also I'm self-taught so don't entirely grasp the jargon as my approach is take an example, alter it, see what happens and then work from there.

This code connects great and if I insert appropriate commands will read directory, create a directory etc etc but it simply will not upload. Any suggestions as to where I'm going wrong (please keep it simple).

<?php
$ftp_server="www.mydomain.co.uk";
$ftp_user_name="myname";
$ftp_user_pass="mypass";
$file="test.txt";
$remote_file="c:\dja\test.txt";

// set up basic connection
$conn_id = ftp_connect($ftp_server);

// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);


// upload a file
if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) {
echo "successfully uploaded $file\n";
} else {
echo "There was a problem while uploading $file\n";
}

// close the connection
ftp_close($conn_id);
?>
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
daybase is offline Offline
2 posts
since Apr 2004
Apr 5th, 2004
0

Re: FTP problem

Are you supposed to have a directory structure in the remote file?
Team Colleague
Reputation Points: 63
Solved Threads: 6
Supreme Evil Overlord
Roberdin is offline Offline
282 posts
since Feb 2003
Apr 6th, 2004
0

Re: FTP problem

I wondered that but how else can you specify the file to be used?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
daybase is offline Offline
2 posts
since Apr 2004
May 20th, 2008
0

Re: FTP problem

i see this problem. its good
Reputation Points: 7
Solved Threads: 0
Newbie Poster
patelmiteshb is offline Offline
10 posts
since Mar 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: how to use php with java script
Next Thread in PHP Forum Timeline: Php Mysql : Code for Multiple Field Search





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC