Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/297.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在不提交html表单的情况下通过AJAX调用在GAE Python NDB中上载文件_Python_Ajax_Google App Engine_Google Cloud Storage_Blobstore - Fatal编程技术网

如何在不提交html表单的情况下通过AJAX调用在GAE Python NDB中上载文件

如何在不提交html表单的情况下通过AJAX调用在GAE Python NDB中上载文件,python,ajax,google-app-engine,google-cloud-storage,blobstore,Python,Ajax,Google App Engine,Google Cloud Storage,Blobstore,我想上传图像文件使用BlobstoreAPI使用AJAX POST,而不是作为html表单提交。基于谷歌搜索,我发现这可以通过使用BlobstoreAPI将图像文件上传到谷歌云存储来实现。我看了一遍,但不明白 我有一个文件类型的html输入元素: Pic <input type="file" name="pic" id="pic_file"> Name <input type="text" name="name" id="name"> Email <input

我想上传图像文件使用BlobstoreAPI使用AJAX POST,而不是作为html表单提交。基于谷歌搜索,我发现这可以通过使用BlobstoreAPI将图像文件上传到谷歌云存储来实现。我看了一遍,但不明白

我有一个文件类型的html输入元素:

Pic <input type="file" name="pic" id="pic_file"> 
Name <input type="text" name="name" id="name"> 
Email <input type="text" name="email" id="email"> 
在我的python文件中

class Admin(BaseRequestHandler): 
    def get(self): 
        :: 
        template_values = { 'url': url, } 
        self.generate('adminpage_1.html', template_values); 
    def post(self): 
        name = self.request.get('name') 
        email = self.request.get('email') 

app = webapp2.WSGIApplication([ 
    ('/', MainHandler), 
    ('/admin', Admin), 
], debug=True) 

如果没有其他插件,我想避免使用其他插件

可能重复感谢Jimmy的参考,但如前所述,我宁愿不使用任何插件。参考答案使用Plupload pluginHere是一个示例说明:Blobstore和Google云存储GCS是两种用于保存Blob的不同技术。如果你刚刚开始学习应用程序引擎,那么就忘了GCS,直接使用Blobstore吧,谢谢Lipis的链接;我找不到太多关于如何使用它的文档,因为他们的文档链接还没有准备好。。
class Admin(BaseRequestHandler): 
    def get(self): 
        :: 
        template_values = { 'url': url, } 
        self.generate('adminpage_1.html', template_values); 
    def post(self): 
        name = self.request.get('name') 
        email = self.request.get('email') 

app = webapp2.WSGIApplication([ 
    ('/', MainHandler), 
    ('/admin', Admin), 
], debug=True)