在谷歌关闭文件上传功能? [英] File upload functionality in google closure?
问题描述
我创建的谷歌应用程序引擎的项目。在这里,我想上传一个文件Blob存储区。
我有一个html文件多种形式,其中每一种形式都有一个文件上传按钮
I am creating a project on google app engine. Here I am trying to upload a file to blobstore.
I have an html file with multiple forms, where each form has a file upload button
<input type="file">
现在,一旦使用此按钮,用户选择一个文件,该文件必须开始上传到GAE Blob存储区。
我有蟒蛇code,可以做到这一点上传东西,但我是不是能够链接我的后端(蟒蛇)code至我浏览过的文件。
此外,由于有多个形成页面不能得到刷新。的
Now as soon as user selects a file using this button the file must start uploading to GAE blobstore.
I have the python code which can do this uploading stuff but I am not able to link my backend (python) code to the file I've browsed.
Also, as there are multiple forms the page must not get refreshed.
我已经找到了解决方案,以刷新页面在谷歌关闭(使用弹出),但它不是我的项目的愿望。我相信这是在封库中没有其他办法。
I have found a solution to page refresh in google closure(using a pop up), but it is not desire in my project. I believe there is no other way in closure library.
我试图做使用AJAX调用,但我很有限的ajax的专业知识,preventing我获得dsired结果吧。
I am trying to do it using ajax call but my very limited knowledge of ajax is preventing me to get the dsired results.
使用jQuery是不是一种选择。
Using JQUERY is not an option.
我希望我的问题是清楚的,请回复,如果没有。
I hope my question is clear, please revert back if not.
任何帮助是非常AP preciated。
Any help is much appreciated.
感谢
推荐答案
谷歌关闭提供了一个IframeIo类,可以将您的文件(无需刷新页面),可在这里的文件,的 HTTP://closure-library.google$c$c.com/svn/docs/class_goog_net_IframeIo.html
Google Closure provides an IframeIo class that can post your file (without refreshing the page), documentation available here, http://closure-library.googlecode.com/svn/docs/class_goog_net_IframeIo.html
我们实现对IframeIo一个包装(在BSD许可证下可用)present一个文件上传输入和张贴到URL的用户,当他们选择一个文件。来源提供的,的https://$c$c.google.com/p/$p$pstans/source/browse/trunk/client/closure/ui/IframeFileUpload.js
We implemented a wrapper on IframeIo (available under the BSD license) to present the user with a file upload input and the post to a URL when they select a file. Source available at, https://code.google.com/p/prestans/source/browse/trunk/client/closure/ui/IframeFileUpload.js
处理成功/失败codeS是有点棘手,这取决于你从你的Blob存储文件的上传处理程序返回的内容。
Handling success / failure codes are little tricky, depending on what you return from your Blobstore file upload handler.
这篇关于在谷歌关闭文件上传功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!