Ask Experts Questions for FREE Help !
Ask
    mickdanger's Avatar
    mickdanger Posts: 1, Reputation: 1
    New Member
     
    #1

    Jul 20, 2005, 04:26 AM
    PHP ftp functions
    I am trying to write a page to ftp files from my PC to my website. I am able to connect and log in using ftp_connect() and ftp_login(), but the ftp_put function won't work. What do I use as the values for the parameters?

    $upload= ftp_put($conn_id,$destination_file,$source_file,FT P_ASCII);
    if (!$upload)
    {echo"sorry, didn't work.";}
    else
    {echo"OK!";}
    ftp_close($conn_id);



    ?>
    LTheobald's Avatar
    LTheobald Posts: 1,051, Reputation: 127
    Ultra Member
     
    #2

    Jul 20, 2005, 04:56 AM
    Whenever you get stuck on a PHP problem, check the PHP manual first. It's fantastic for things like this - PHP Manual: ftp_put(). There is also a full example for you to take a look at.

    The parameters needed are in your example are:

    $conn_id
    This is the FTP connection you established using ftp_connect()

    $destination_file
    The file path of what you want to send. E.g. 'C:\test.txt'

    $source_file
    Where you want this file stored on your FTP server. E.g. '\public_html\test.txt'

    FTP_ASCII
    This is a constant defining the transfer mode. It must either be FTP_ASCII (used for text (ASCII) based files) or FTP_BINARY for binary files (executables, sound files etc.) Note: There was a space in the FTP_ASCII constant in your example - remove that or the function won't work.


    For a full list of PHP's FTP functions, check here

    One final tip: When posting PHP code into the forum, surround it by the [ code ][/ code ] brackets (remove spaces). It makes it look better:

    Code:
    <?php
    function sayHello() {
        // Code is formatted nicely
        echo 'Hello world!';
    }
    ?>

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Solving Functions [ 5 Answers ]

Knowing f(x)=x^2+x and g(x)=2x+1 how would you solve f(g(x)) and (g (circle) f)(4)?? How do you determine the f^(-1) of f(x)=3x-2? Is x+2/3 correct? Thanks

Polynomial Functions [ 1 Answers ]

Using transformations and the zeros of the polynomial function f(x)=x(x-4)(x+2) how could you determine the zeros of y=f(2x)?? Thanks

Functions [ 7 Answers ]

Why would f(x) =pi/4x^3-sqrt2x+4 be classified as a polynomial? How would you determine the domain and range of y=x^4-4x^2? Assuming that the zeros of the function y=x^3+mx^2+nx+2 are integers how would you determine the values of m and n?? Thank you.

Algebra of functions [ 1 Answers ]

#1 Given f(x)-x^2-4 and g(x)=2x-1 how would you determine the value of (f+g)(3) and (f/g)(-1)? #2 If f(x)=x+2 and g(x)=x how would you find the value or values for which (fg)(x)=8? Thank you.


View more questions Search