Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ftp_chdir(3) [php man page]

FTP_CHDIR(3)								 1							      FTP_CHDIR(3)

ftp_chdir - Changes the current directory on a FTP server

SYNOPSIS
bool ftp_chdir (resource $ftp_stream, string $directory) DESCRIPTION
Changes the current directory to the specified one. PARAMETERS
o $ftp_stream - The link identifier of the FTP connection. o $directory - The target directory. RETURN VALUES
Returns TRUE on success or FALSE on failure. If changing directory fails, PHP will also throw a warning. EXAMPLES
Example #1 ftp_chdir(3) example <?php // 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); // check connection if ((!$conn_id) || (!$login_result)) { die("FTP connection has failed !"); } echo "Current directory: " . ftp_pwd($conn_id) . " "; // try to change the directory to somedir if (ftp_chdir($conn_id, "somedir")) { echo "Current directory is now: " . ftp_pwd($conn_id) . " "; } else { echo "Couldn't change directory "; } // close the connection ftp_close($conn_id); ?> SEE ALSO
ftp_cdup(3), ftp_pwd(3). PHP Documentation Group FTP_CHDIR(3)

Check Out this Related Man Page

FTP_PUT(3)								 1								FTP_PUT(3)

ftp_put - Uploads a file to the FTP server

SYNOPSIS
bool ftp_put (resource $ftp_stream, string $remote_file, string $local_file, int $mode, [int $startpos]) DESCRIPTION
ftp_put(3) stores a local file on the FTP server. PARAMETERS
o $ftp_stream - The link identifier of the FTP connection. o $remote_file - The remote file path. o $local_file - The local file path. o $mode - The transfer mode. Must be either FTP_ASCII or FTP_BINARY. o $startpos -The position in the remote file to start uploading to. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 ftp_put(3) example <?php $file = 'somefile.txt'; $remote_file = 'readme.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 "; } else { echo "There was a problem while uploading $file "; } // close the connection ftp_close($conn_id); ?> SEE ALSO
ftp_pasv(3), ftp_fput(3), ftp_nb_fput(3), ftp_nb_put(3). PHP Documentation Group FTP_PUT(3)
Man Page

15 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Downloading whole directory with FTP

Is it possible using FTP to download a whole directory and all subdirectories at once without having to go through every single file? Thanks, Tom (4 Replies)
Discussion started by: Pokeyzx
4 Replies

2. Shell Programming and Scripting

Script to cd into newest (dated) FTP directory

I have written the following simple bash script. It logs onto an FTP site and then CDs into a directory that corresponds to the last business day. So for example the directory I would access today is 20060110 (2006 jan 10). I am currently taking today's date and subtracting 1, putting this... (3 Replies)
Discussion started by: steved
3 Replies

3. UNIX for Dummies Questions & Answers

Automated FTP to variable directory with error check

Hi, automated FTP that have error check and each product FTP will used the same userid/password to post(transfer) the file(s) from their <product> directory at UNIX to their <product> folder at Windows. such senarios as follows: NOTE: ======= ** Variable ** * The <product> is variable... (3 Replies)
Discussion started by: songtam
3 Replies

4. Shell Programming and Scripting

changing permission using FTP

Dear all, i want to change file permision of remote dir using FTP. is that possible? what i'm doing is i'm simply doing chmod 777 filename after establishing the connection with remote server using ftp... but the result showing is 550 SITE CHMOD command failed. can any body plz help?... (3 Replies)
Discussion started by: panknil
3 Replies

5. UNIX for Dummies Questions & Answers

Basic variable questions

when you see something like this export SOMEDATA=.:/somedir/files what does the ".:" mean? I think the the "." alone would mean current directory but the ":" together is kind of new to me. (6 Replies)
Discussion started by: NycUnxer
6 Replies

6. Shell Programming and Scripting

How to Get the File Input from Parameter

pdir=`pwd` if ; then echo current directory $pdir ls -altr echo fi for f in $* do # directory if ; then echo current directory $f cd $f ls -latr echo fi # but you can test file/dir # regular file only if ; then echo... (4 Replies)
Discussion started by: wtolentino
4 Replies

7. Shell Programming and Scripting

setting directory variable?

I have the following script and would like to know how to set the variable correctly. FTP downloads the .rpm to the current directory, so the RPM command needs to know the directory it is in. I could use ./test-application-1.0.i386.rpm to execute the command, but is there a way to set the... (6 Replies)
Discussion started by: nolamiami
6 Replies

8. Shell Programming and Scripting

Conditionally prepending text

I am currently writing a script to compare a file list created over an FTP connection to a local directory. I have cleaned the FTP file list up so that I just have a raw list of filenames however due to the directory structure employed (both locally and on the ftp site) I need to prepend each line... (6 Replies)
Discussion started by: Dal
6 Replies

9. Shell Programming and Scripting

FTP Connection die out

Hi, I will ftp aroung 80 files after connecting to an FTP Server. But after 2 minutes of connection, it is timed out and connection is dying. Server had a 2 minute connection timeout if connection is idle. But my question, Isn't tranfering files not considered as an activity. Is the connection... (7 Replies)
Discussion started by: vasuarjula
7 Replies

10. UNIX for Dummies Questions & Answers

Filenames change in a directory

Hi I have abc_ahb_one.v abc_ahb_two.v abc_ahb_three.v ........l like this -----upto abc_ahb_ninety.v in some directory. I need to change those file names to like below. ... (5 Replies)
Discussion started by: praneethk
5 Replies

11. Shell Programming and Scripting

IF and FI in UNIX

I am new to Unix. With the following code, I am trying to check if there is any existing file xxx.txt in the current directory and echo "error message" if not found in current directory . The whole script is erroring out, can someone help me Here is my code $ cat -n ifelseif_01.sh 1 ... (7 Replies)
Discussion started by: pyerragudi
7 Replies

12. Shell Programming and Scripting

check if a given string is a file or directory

hi i want to know how to do this if the given is /tmp/ and it is a valid directory then it will echo directory if the given is /tmp/file.txt and is a valid file then it will echo file.. thanks! (5 Replies)
Discussion started by: h0ujun
5 Replies

13. Shell Programming and Scripting

FTP Login Error check

How can I add a check right after the FTP to see if the login id failed or not and echo an error description indicating login failed? Here is my script: ftp $HOST1 <<END_SCRIPT>>$TARGETLOGS/$LOGFILE #ftp $HOST1 <<END_SCRIPT> cd idx prompt mget $PICKUPFILE*.txt !cp $PICKUPFILE*... (17 Replies)
Discussion started by: mrn6430
17 Replies

14. Shell Programming and Scripting

Need Script to check the FTP connection

Hi, I need a script which check the FTP connections, if its working fine then no issue. Incase not working fine then Trigger the mail. Please help on this. Thanks (4 Replies)
Discussion started by: Keshav Kalra
4 Replies

15. Programming

QFTP connection refused problem in WEC7

Hi I tried FTP transfer from WEC7(Windows Embedded Compact 7) to another windows 7.I am getting the connection refused error. Could you please help me to resolve this. what are the reasons one person can get connection refused while trying to connect through QFTP. Tool : Qt 4.8 Thank... (4 Replies)
Discussion started by: SA_Palani
4 Replies