1 like 0 dislike
48 views
How to create directory and send a file to a remote server
in Education & Reference by (810 points) | 48 views

1 Answer

0 like 0 dislike
$uploadfile="var/www/htnl/test/123.jpg";
$connection = ssh2_connect('IP', 22);
ssh2_auth_password($connection, 'root', 'pwd');
$newpath=str_replace("OLDPATH","NEWPATH",$uploadfile);
$sftp = ssh2_sftp($connection);
ssh2_sftp_mkdir($sftp, "NEWPATH/XYZ/" 0777);
ssh2_scp_send($connection, $uploadfile, $newpath, 0777);
unlink($uploadfile);
by (600 points)

Related questions

1 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
1 like 0 dislike
1 answer
0 like 0 dislike
1 answer

Where your donation goes
Technology: We will utilize your donation for development, server maintenance and bandwidth management, etc for our site.

Employee and Projects: We have only 15 employees. They are involved in a wide sort of project works. Your valuable donation will definitely boost their work efficiency.

How can I earn points?
Awarded a Best Answer 10 points
Answer questions 10 points
Asking Question -20 points

1,200 questions
1,346 answers
471 comments
1,922 users