Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2012
    Posts
    7

    Unanswered: Any alternatives to ftp?

    Hi There, Is there any efficient ways in PHP other than ftp to get a file from remote server?

  2. #2
    Join Date
    Sep 2009
    Location
    Ontario
    Posts
    1,057
    Provided Answers: 1
    Code:
    # more upload.php                                                       
    <!-- The data encoding type, enctype, MUST be specified as below -->    
    <form enctype="multipart/form-data" action="upload2.php" method="POST"> 
        <!-- MAX_FILE_SIZE must precede the file input field -->            
        <input type="hidden" name="MAX_FILE_SIZE" value="30000" />          
        <!-- Name of input element determines name in $_FILES array -->     
        Send this file: <input name="userfile" type="file" />               
        <input type="submit" value="Send File" />                           
    </form>                                                                 
    #
    Code:
    # cat upload2.php                                                               
    <?php                                                                           
            session_start();                                                        
            $uniq = session_id();                                                   
            $uploadfile = $_POST['userfile'];                                       
            $REMOTE_ADDR = $_SERVER['REMOTE_ADDR'];                                 
            $output = `/usr/lib/apache/htdocs/content/ccds/upload.ksh$REMOTE_ADDR $uniq$uploadfile`;                                                              
                                         
    ?>
    Upload2 presumes a login procedure and a session has been started previously. Adjust the MAX_FILE_SIZE to suit.

  3. #3
    Join Date
    Aug 2008
    Posts
    147
    it may be worth looking at pscp. pscp is part of the Putty suite . The pscp program is works on the command
    ---------------------------------
    www.sqlserver-dba.com
    www.dba-db2.com

  4. #4
    Join Date
    Sep 2009
    Location
    Ontario
    Posts
    1,057
    Provided Answers: 1
    To move a file from the server to the client:
    PHP: readfile - Manual

  5. #5
    Join Date
    Nov 2012
    Posts
    3
    did you try cURL? you can upload or download file using cURL ... i think it is easier and more efficient than FTP.

  6. #6
    Join Date
    Sep 2012
    Posts
    21
    i searched for this question.good discussion.thanks for sharing.I also try cURL.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •