note 101408 added to function.file-put-contents
| From: | ravianshmsr08 at gmail dot com | Date: | Wed, 15 Dec 2010 09:39:48 +0000 |
| Subject: | note 101408 added to function.file-put-contents | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-174936@lists.php.net to get a copy of this message | ||
To upload file from your localhost to any FTP server.
pease note 'ftp_chdir' has been used instead of putting direct remote file path....in
ftp_put ...remoth file should be only file name
$host = '*****';
$usr = '*****';
$pwd = '**********';
$local_file = './orderXML/order200.xml';
$ftp_path = 'order200.xml';
$conn_id = ftp_connect($host, 21) or die ("Cannot connect to host");
ftp_pasv($resource, true);
ftp_login($conn_id, $usr, $pwd) or die("Cannot login");
// perform file upload
ftp_chdir($conn_id, '/public_html/abc/');
$upload = ftp_put($conn_id, $ftp_path, $local_file, FTP_ASCII);
if($upload) { $ftpsucc=1; } else { $ftpsucc=0; }
// check upload status:
print (!$upload) ? 'Cannot upload' : 'Upload complete';
print "\n";
// close the FTP stream
ftp_close($conn_id);
----
Server IP: 69.147.83.197
Probable Submitter: 122.180.76.114
----
Manual Page -- http://www.php.net/manual/en/function.file-put-contents.php
Edit -- https://master.php.net/note/edit/101408
Del: integrated -- https://master.php.net/note/delete/101408/integrated
Del: useless -- https://master.php.net/note/delete/101408/useless
Del: bad code -- https://master.php.net/note/delete/101408/bad+code
Del: spam -- https://master.php.net/note/delete/101408/spam
Del: non-english -- https://master.php.net/note/delete/101408/non-english
Del: in docs -- https://master.php.net/note/delete/101408/in+docs
Del: other reasons-- https://master.php.net/note/delete/101408
Reject -- https://master.php.net/note/reject/101408
Search -- https://master.php.net/manage/user-notes.php