Geek4 Posted November 16, 2017 Share Posted November 16, 2017 Hi Fellows, I am having trouble sending a file to SFTP and error coming in line 14 Warning: ssh2_scp_send(): Failure creating remote file: (null) in path on line 14 fyi, i have read write permissions to that sftp folder <?php $server = 'sftp.my.com'; $port = '22'; $username = 'myLogin'; $passwd = 'Pa$$w0rd'; $localFile = '000001.txt'; $connection = ssh2_connect($server, $port); if (ssh2_auth_password($connection, $username, $passwd)) { echo "Connection successful, uploading file now...</br>"; $sftp = ssh2_sftp($connection); $sftp = ssh2_scp_send($connection, "000001.txt", "/upload/".$localFile, 0644); if($sftp){ echo"<h1>Success</h1>"; return ":)"; } upload.php Link to comment Share on other sites More sharing options...
requinix Posted November 17, 2017 Share Posted November 17, 2017 You are not using SFTP. You are using SCP. Are you saying there is a /upload at the root of the remote server? Are you sure that's the full path to the directory you want? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.