How to write Big files into Blobstore using experimental API?

前端 未结 2 1722
礼貌的吻别
礼貌的吻别 2020-12-28 09:41

I have dilemma.. I\'m uploading files both in scribd store and blobstore using tipfy as framework. I have webform with action is not created by blobstore.create_upload_url (

2条回答
  •  南方客
    南方客 (楼主)
    2020-12-28 09:57

    finally i found solution.

    Nick Johneson's answer occurred attribute error because uploaded_file is treated as string. string didn't have read() method.

    Cause string doesn't have method read(), i spliced file string and write it just like he wrote.

    class UploadRankingHandler(webapp.RequestHandler):
      def post(self):
        fish_image_file = self.request.get('file')
    
        file_name = files.blobstore.create(mime_type='image/png', _blobinfo_uploaded_filename="testfilename.png")
    
        file_str_list = splitCount(fish_image_file,65520)
    
        with files.open(file_name, 'a') as f:
          for line in file_str_list:
            f.write(line)
    

    you can check about splitCount(). here

    http://www.bdhwan.com/entry/gaewritebigfile

提交回复
热议问题