google app engine - Upload binary file to GAE Python Blobstore -
i can upload text files (.csv, .json) code, can't upload excel file (.xls or .xlsx).
class createteam(blobstore_handlers.blobstoreuploadhandler, basehandler): def get(self): upload_url = blobstore.create_upload_url('/create_team') context = {'upload_url': upload_url} self.render('create_team.html', **context) def post(self): blob_info = self.get_uploads('file')[0] blob_key = blob_info.key() blob_reader = blobstore.blobreader(blob_key) file_data = blob_reader.read() # line stalls out blobstore.delete(blob_key()) self.redirect('/')
when try one-line .xls file, blob_reader.read() line locks on mac. in browser (chrome), tab icon seems spin forever , gae launcher freezes up. have quit , start over.
my html looks this:
<form method="post" action={{ upload_url }} enctype="multipart/form-data"> <div> <p>upload file</p> <input type="file" name="file"> </div> </form>
do binary files handled differently uploads? form above over-simplified. have other form elements posted @ same time.
Comments
Post a Comment