views:

28

answers:

0

Model ..

def self.upload_client_document(params)
  client_document = self.new :uploaded_data => params[:Filedata],:client_id => params[:client_id],:document_name => self.default_document_name,:document_description => self.default_description_name
  client_document.rename_document_name
  client_document.save!
  # RAILS_ROOT + client_document.public_filename This will return path to file like
  # C:/projects/test_project/client_documents/0000/0012/A100-bal.csv
  RestClient.post 'http://demo.testltd.com/V12345/search.aspx?username=test1&password=test2',
  :upload => File.new(RAILS_ROOT + client_document.public_filename)  
end

Getting error Errno::ENOENT (No such file or directory - C:/projects/test_project/client_documents/0000/0012/A100-bal.csv):

But file is there in the folder ...

Any idea ? What's problem with this code ? Anything i need to modify for rest-client ?