Using rest-client to upload a paperclip attachment but getting no file found error
- by Angela
Hello,
I have a paperclip attachment that I wan to upload to a web-service using rest-client.  However, when I try to run it, I get an error:
No such file or directory - /system/postalimages/1/original/postcard-1.png?1274635084
But the file exists for sure:  I see it in my directory.  How do I debug this?
Here is the code in my controller which makes the upload:
def upload
    @postalcard = Postalcard.find(:last)
    response = RestClient.post('http://www.postful.com/service/upload', {
                  :upload => {
                    :file => File.new(@postalcard.postalimage.url,'rb')
#paperclip file path
                   }
                }, #end payload
                {"Content-Type" => @postalcard.postalimage.content_type,
                 "Content-Length" => @postalcard.postalimage.size,
                 "Authorization" => 'Basic dGltZm9uZzg4OEBnbWFpbC5jb206ZDlQcTVKUU4='}
# end headers
               ) #close arguments to Restclient.post
    return response.body
       end