User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 423,010 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,926 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 2465 | Replies: 3
Reply
Join Date: Apr 2004
Posts: 2
Reputation: daybase is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
daybase daybase is offline Offline
Newbie Poster

FTP problem

  #1  
Apr 5th, 2004
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);
?>
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2003
Location: London, England
Posts: 281
Reputation: Roberdin will become famous soon enough Roberdin will become famous soon enough 
Rep Power: 7
Solved Threads: 6
Colleague
Roberdin Roberdin is offline Offline
Supreme Evil Overlord

Re: FTP problem

  #2  
Apr 5th, 2004
Are you supposed to have a directory structure in the remote file?
Reply With Quote  
Join Date: Apr 2004
Posts: 2
Reputation: daybase is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
daybase daybase is offline Offline
Newbie Poster

Re: FTP problem

  #3  
Apr 6th, 2004
I wondered that but how else can you specify the file to be used?
Reply With Quote  
Join Date: Mar 2008
Location: India
Posts: 5
Reputation: patelmiteshb is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
patelmiteshb's Avatar
patelmiteshb patelmiteshb is offline Offline
Newbie Poster

Re: FTP problem

  #4  
May 20th, 2008
i see this problem. its good
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 3:59 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC