Question

I have a rails 3.2.2 app that's got the net-sftp gem installed on it.

I've created a simple controller to test the most basic feature of uploading a file to remote sftp.

This is my controller:

class UploadsController < ApplicationController
  require 'net/sftp'

  def upload
    Net::SFTP.start('host', 'root', :password => 'password') do |sftp|
      @sftp = sftp # I've got a session object so that seems to work

      # upload a file or directory to the remote host
      sftp.upload!("/Users/kensodev/Desktop/ashrit.xml", "/domains/inbar-paz.com/html/test/ashrit.xml")
    end
  end
end

When I visit "localhost:3000/uploads/upload" path I get this error:

Net::SFTP::StatusException open /domains/inbar-paz.com/html/test/ashrit.xml (2, "no such file")

Maybe I got the paths wrong?

Thanks you for trying to help :) Paz.

Was it helpful?

Solution

One of the directories in this path "/domains/inbar-paz.com/html/test/" doesn't not exist.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top