我的回形针文档在哪里?寻找正确的道路
我有一个保存用户文档的网站,我想使用 Paperclip 通过 Google 文档查看器 (https://drive.googleblog.com/2009/09/view-online-files-using-google-docs.html )。
回形针正在工作。例如,我有一个文件保存在: 127.0.0.1:3000/assets/resumes/51/original/myfile.pdf
我想通过我的网站中嵌入的查看器显示该内容。这是我的代码(在 HAML 中):
%iframe{:src=>"http://docs.google.com/viewer?url=http%3A%2F%2F127.0.0.1:3000/#{@user.file.url}&embedded=true"}
问题只是因为我还没有在公共服务器上启动并运行该网站,还是我的代码有问题? (当我将网址直接粘贴到浏览器中而没有查看器内容时,我确实看到了该文件。)
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 something wrong with my code? (When I paste the url straight into my browser without the viewer stuff I do see the file.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的假设是正确的。它不起作用,因为您的应用程序不在公共环境中,并且 Google 文档无法通过您的本地主机地址访问您的 PDF。
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.