Ruby on Rails Wednesday, January 25, 2017

Yes it was the issue of text. file is reading the doc as text not binary. Thanks for your help

Paramnoor Singh

On Wednesday, January 25, 2017 at 5:30:55 PM UTC+5:30, Paramnoor Singh wrote:

Problem: I have use the net/http code for uploading the '.doc', '.docx', '.pdf' and images files on dropbox. But I getting the issues like:

1.invalid byte sequence in UTF 8
2. Now while the file is uploading but it not uploading the content and even it uploading as a corrupt file.

Below I writing my code to upload the file on dropbox. Please help me.


uri = URI.parse("")
          request =
          request.content_type = "application/octet-stream"
          request["Authorization"] = "Bearer #{$acess_token}"
          request["Dropbox-Api-Arg"] = "{\"path\":\"/Sass-for-Web-Designers.pdf\"}"
          request.body = ""
          request.body <<"app/assets/images/categoryImages/Sass-for-Web-Designers.pdf").read
            #request.body << file.content

No comments:

Post a Comment