使用 Coldfusion 上传 google 文档
我在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会尝试使用 上传协议指南。
I would try to expand
cfgoogle
CFC withupload
method using Protocol Guide for uploading.