Results 1 to 3 of 3

Thread: Copy Files from one server to another using PHP

  1. #1
    Join Date
    Apr 2007

    Thumbs up Copy Files from one server to another using PHP

    Hi ,
    I have hosted my web site on one server (server 1)and my media files are stored on other server (server 2). Now server 2 has sftp login system. Server2 is the media server.

    When the user enter his username on my web page on server1 , I want to list all the files from server2 on to this web page. So how can I write a script that would allow me to login to server2 which has sftp and get the list of the files.
    All files are stored in following format

    GourpID - UserId -media<computer generated random number).flv


    If we cannot do it with Php then what would be the best way to do it.

  2. #2
    Join Date
    Mar 2007
    You could have a basic php script on Server 2 that accepts a secret key so it can list user's files.

    let's say server2/sys/app/list-files.php?secret=abc12345&user_id=123

    For additional security on Server 2 you might want to also check for the REMOTE_ADDR in list-files.php

    Another option is to setup key based login and use ssh to list users files.

    hope this gives you an idea how to proceed.

  3. #3
    Join Date
    Aug 2004
    Maybe use PHP's FTP functions?
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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