#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    81
    Rep Power
    11

    Angry Uploading file thru PHP Script ..


    Hello -

    I am using this PHP Upload script to upload file on my webspace. Its connects properly but fails to upload file. I am trying to upload test.txt file from my c:\ to my webs wwwroot directory .Can someone have a look and let me know where I am going wrong :

    <?php
    /*
    * Uploads screenshots and inserts all of the info into database */
    //ftp user info
    $username="username";
    $password="password";
    $host="ftp.mydomain.com";
    $path="//wwwroot//test.txt";

    //variables to connect and login to ftp
    $conn_id = ftp_connect($host);
    $login_result = ftp_login($conn_id, $username, $password);

    if ((!$conn_id) || (!$login_result))
    {
    die("Connection to FTP failed!");
    }

    //upload the file onto the server
    $upload = ftp_put($conn_id, $path, "C://test.txt", FTP_BINARY);

    if (!$upload)
    {
    die("FTP upload has failed!");
    }
    //close ftp connection
    ftp_close($conn_id);

    ?>
    Rubal Jain
    Webspiders Interweb Pvt. Ltd. & Brainus Networks
    http://www.it2ecom.com | http://www.brainus.net
    Server Management | Dedicated Servers | Reseller Hosting
    Experienced, Qualified Techs | 24/7 Support Centers in India
    Helm Premium Partners | Email : sales@brainus.net
  2. #2
  3. No Profile Picture
    Stumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,409
    Rep Power
    4538
    I don't run PHP on Windows, maybe someone else has used PHP uploads on a windows box.
  4. #3
  5. Retired Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2004
    Location
    London, UK
    Posts
    6,669
    Rep Power
    147
    Hi,

    I've got uploads working on a Windows server. I'm not sure what is wrong with your code, but I followed the guide at http://www.phpfreaks.com/tutorials/85/0.php and this got me going fine!

    HTH,

    Edwin

IMN logo majestic logo threadwatch logo seochat tools logo