www.webdeveloper.com
Results 1 to 3 of 3

Thread: ssh2_scp_send() using php corrupts pdf

  1. #1
    Join Date
    Nov 2013
    Posts
    2

    ssh2_scp_send() using php corrupts pdf

    I am having a problem when I am sending a pdf file to my server.

    my script works when I try to send .csv file but the problem occurs when I try to send a pdf file

    <?php
    $user= "username";
    $pass= "password";
    $src= "/home/desktop/myfile.pdf";
    $trg= "/server/path/myfile.pdf";

    $con = ssh2_connect('myserver.com', 22);
    ssh2_auth_password($con, $user, $pass);

    ssh2_scp_send($con, $src, $trg);
    ?>
    when I send pdf. it creates a pdf file in target location but its corrupted.

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,248
    Try adding this after the send to flush the buffer:
    PHP Code:
    ssh2_exec($con'exit'); 
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Nov 2013
    Posts
    2
    Quote Originally Posted by NogDog View Post
    Try adding this after the send to flush the buffer:
    PHP Code:
    ssh2_exec($con'exit'); 
    Thanks, but it didn't work. I didn't saw any changes and still get corrupted pdf on my remote server.

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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



Recent Articles