【发布时间】:2016-11-01 16:19:47
【问题描述】:
我正在做一个项目,我正在尝试将图像上传到 blob 商店。但是我收到了这个错误
文件“C:\Users\shaizi\PycharmProjects\simpletestapp\Update.py”,行 51,在帖子中
blob_info = upload_files[0]
IndexError: 列表索引超出范围
我的html表单代码是
<form id="signup" method="post" action="/update" enctype="multipart/form-data">
<label>Change image:</label>
<input type="file" name="pict" ><br>
</form>
将图片上传到 Blob 存储的 Python 代码:
def post(self):
blobstore.create_upload_url('/post/signup')
upload_files = self.get_uploads('pict')
blob_info = upload_files[0]
【问题讨论】:
-
你能显示
self.get_uploads的代码吗? -
上传文件的内置函数。
标签: python google-app-engine blobstore webapp2