使用 Coldfusion 上传 google 文档

发布于 2024-11-06 20:50:01 字数 1268 浏览 0 评论 0原文

我在 ColdFusion 中构建了一个类似论坛的应用程序,我想添加一项功能,用户可以使用其 Google 帐户将文件上传到 Google 文档,然后其他用户可以编辑这些文件。

我一直在使用此 CFC:http://cfgoogle.riaforge.org/ 来检索 Google 文档,但是目前缺少上传功能。我需要上传功能来第一次上传文件,然后进行第二部分编辑。我希望这是有道理的。

这就是我寻求帮助的原因。我对 cffunctions 没有那么丰富的经验,我想知道是否有人可以帮助我。

这是我到目前为止所得到的:

<cffunction name="upload" access="public" returnType="any" hint="I upload the document." output="false">
<cfargument name="myFile" type="string" required="true" hint="file to upload.">

<cfset var result = "">
<cfset var service = variables.docservice>

<cfset theUrl = "https://docs.google.com/feeds/documents/private/full HTTP/1.1">

<cfhttp url="#theURL#" method="post" result="result">
<cfhttpparam type="header" name="Authorization" value="GoogleLogin auth=#getAuth(service)#">
<cfhttpparam type="header" name="Content-Length" value="81047">
<cfhttpparam type="header" name="Content-Type" value="application/msword">
<cfhttpparam type="header" name="Slug" value="#myFile#">
</cfhttp>

<cfreturn result.filecontent>

</cffunction>

但是当我输出结果时出现以下错误: “无效的请求 URI”

如果有人可以帮助我解决这个问题(即使只是告诉我方法),我将不胜感激。

I've built a forum-like app in ColdFusion and I want to add a feature with which the users can upload files to Google Docs using their Google accounts and then other users can edit those files.

I've been using this CFC: http://cfgoogle.riaforge.org/ to retrieve Google Docs, but the upload function is currently missing. I need the upload function for the first upload of the file and then for the second part of editing it. I hope that it makes sense.

That's what I'm asking help for. I'm not that experienced with cffunctions and I was wondering if someone could give me a hand with it.

This is what I have so far:

<cffunction name="upload" access="public" returnType="any" hint="I upload the document." output="false">
<cfargument name="myFile" type="string" required="true" hint="file to upload.">

<cfset var result = "">
<cfset var service = variables.docservice>

<cfset theUrl = "https://docs.google.com/feeds/documents/private/full HTTP/1.1">

<cfhttp url="#theURL#" method="post" result="result">
<cfhttpparam type="header" name="Authorization" value="GoogleLogin auth=#getAuth(service)#">
<cfhttpparam type="header" name="Content-Length" value="81047">
<cfhttpparam type="header" name="Content-Type" value="application/msword">
<cfhttpparam type="header" name="Slug" value="#myFile#">
</cfhttp>

<cfreturn result.filecontent>

</cffunction>

But I get the following error when I output the result:
'Invalid request URI'

If someone could help me out with this one (even just show me the way), it would be mostly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不顾 2024-11-13 20:50:01

我会尝试使用 上传协议指南

I would try to expand cfgoogle CFC with upload method using Protocol Guide for uploading.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文