SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Sep 2010
    Posts
    131
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Upload from server

    I want to upload from my server "target.txt" that is "source.,txt" on the server. I can not get the $source right for my webserver. Any suggestions?

    PHP Code:
    <?php
    $source 
    "/home/source.txt";
    $target fopen("target.txt""w");

    $conn ftp_connect("ftp.testftp.com") or die("Could not connect");
    ftp_login($conn,"user","pass");

    ftp_fget($conn,$target,$source,FTP_ASCII);

    ftp_close($conn);
    ?>

  2. #2
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,189
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Usually the /home/ path is always followed your servers username which is started on unix servers, eg. /home/xxx123/source.txt

  3. #3
    SitePoint Zealot
    Join Date
    Sep 2010
    Posts
    131
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have tried many ways to get the right $source to work. I have tried:

    $source = "/home/path/source.txt";
    $source = "ftpname@webserver.com/home/path/source.txt";
    $source = "http://www.webserver.com/home/path/source.txt";
    $source = "ftp.webserver.com/home/path/source.txt";
    $source = "c:/home/path/source.txt"; //obviously does not work
    Does anyone know how to input a valid $source?

  4. #4
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,189
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Have you tried your FTP settings in an FTP client to check the paths as that would be the best way to go about it.


Bookmarks

Posting Permissions

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