tampe125
tampe125

Reputation: 8533

ftp_put sends incomplete file

i have to put an xml file to a remote server, using php.

my file is created by a php script (and everything is ok), then i upload it to another server.
but when it goes there, the file is incomplete! lasts 10 lines are stripped out.

any help?

PHP CODE

function upload(){  
    $ftp = ftp_connect('ftp.myhost.com');  
    $rc  = ftp_login($ftp, 'myuser', 'mypwd');  
    $rc  = ftp_pasv ($ftp, FALSE);  
    $rc  = ftp_chdir($ftp, $folder);  
    $rc  = ftp_put  ($ftp, 'myfile.xml', 'myfile.xml', FTP_ASCII);  
    ftp_close($ftp);  
}

Upvotes: 0

Views: 1143

Answers (2)

Ankur
Ankur

Reputation: 111

HI,

User FTP_BINARY instead of FTP_ASCII check for the filesize also, may be possible that your server does not allow heavy files

Upvotes: 1

James
James

Reputation: 2669

Have you tried using 'FTP_BINARY' instead of 'FTP_ASCII'?

Also, I don't think its what is causing your problem but where does the $folder variable get populated in your code?

Upvotes: 2

Related Questions