简体   繁体   中英

How to upload image to other server

I'm using the code given in the link - https://www.simplifiedcoding.net/android-upload-image-to-server/ . The image is storing fine in the same server, however I need to store the image in different server. Is this possible using PHP?

I modified my codings but still my file is not transferable.

$ch = curl_init ("Source file’s complete url”);
 curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
$rawdata = curl_exec($ch);
// Check if any error occured 
if(curl_errno($ch)) 
{ 
  $fp = fopen(“Destination file’s complete url”, 'w');
  fwrite($fp, $rawdata);
  fclose($fp);
}
curl_close ($ch);
ob_flush();
flush();

Have replaced source and destination url, but still no results, please help me..

$connection = ssh2_connect('shell.example.com', 22);

ssh2_auth_password($connection, 'username', 'password');

ssh2_scp_send($connection, '/local/filename', '/remote/filename', 0644);

Please refer this link : https://www.php.net/manual/en/function.ssh2-scp-send.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM