开发者

Where's my Paperclip doc? Finding the right path

开发者 https://www.devze.com 2023-01-14 17:06 出处:网络
I have a site that saves user documents and I want to use Paperclip to display them using Google Docs Viewer (https://drive.googleblog.com/2009/09/view-online-files-using-google-docs.html).

I have a site that saves user documents and I want to use Paperclip to display them using Google Docs Viewer (https://drive.googleblog.com/2009/09/view-online-files-using-google-docs.html).

Paperclip is working. For instance, I have a file saved at: 127.0.0.1:3000/assets/resumes/51/original/myfile.pdf

I want to display that through the viewer embedded in my site. This is my code (in HAML):

%iframe{:src=>"http://docs.google.com/viewer?url=http%3A%2F%2F127.0.0.1:3000/#{@user.file.url}&embedded=true"}

Is the problem just the fact that I haven't got the site up and running on a public server yet, or is s开发者_运维技巧omething wrong with my code? (When I paste the url straight into my browser without the viewer stuff I do see the file.)


Your assumption is correct. It is not working because your application is not in a public environment and Google Docs has no way of accessing your PDFs through your localhost address.

0

精彩评论

暂无评论...
验证码 换一张
取 消