フォーム内の複数のファイルをBlobStoreにアップロードしようとしています。
形:
<form action="{{upload_url}}" method="POST" enctype="multipart/form-data">
<label>Key Name</label><input type="text" name="key_name" size="50"><br/>
<label>name</label><input type="text" name="name" size="50"><br/>
<label>image</label><input type="file" name="image" size="50"><br/>
<label>thumb</label><input type="file" name="thumb" size="50"><br/>
<input type="submit" name="submit" value="Submit">
</form>
次に、アップロードされたファイルごとにBlobInfoオブジェクトをフェッチしようとしています。
def post(self):
image_upload_files = self.get_uploads('image')
thumb_upload_files = self.get_uploads('thumb')
image_blob_info = image_upload_files[0]
thumb_blob_info = thumb_upload_files[0]
奇妙な振る舞いが見られます。どちらのファイルもBlobStoreに組み込まれていますが、キーを取得して別のエンティティに保存する方法がわかりません。上記のコードは、image_blob_infoのキーを取得できますが、thumb_blob_infoは取得できません。get_uploadsの使い方がわかりません。フォームを介して複数のファイルを渡し、名前でフェッチして、別のエンティティの適切なBlobReferencePropertiesに保存できるようにします。