-1
我使用web.py作为我的项目的RESTful服务器,现在我遇到了一个问题,就是如何上传文件。 在Phonegap官方文档中,我找到了这个例子,但它是由PHP编写的,在服务器端它使用了一个名为的函数move_uploaded_file()。我认为这是获取文件然后将其保存在用户的地方想。如何使用Web.py + phonegap上传文件
所以,这是我的问题,有没有类似的东西在我web.py.Or怎么可能得到的文件与web.py?
我需要一些帮助,谢谢。
我已经完成了。 在客户端:
function uploadPhoto(imageURI) {
var options = new FileUploadOptions();
options.fileKey="file";#keep this name the same as server
...
ft.upload(imageURI, "http://some.server.com/upload", win, fail, options);
}
在服务器端:
def POST(self):
files = web.input(file={})#where the client side defined
data = files['file'].file.read()#got the data
...do something you wanted...
我看到这一点,但在客户端,没有形式,只是可以使用phonegap API名称是filetranser,它将文件发送到服务器。我已经尝试在服务器端的上述代码获取文件竞争或文件对象,但它不工作....... – 2013-05-12 04:54:48