def upldfile(): if request.method == 'POST': file = request.files['file'] if file and allowed_file(file.filename): filename = secure_filename(file.filename) app.logger.info('FileName: ' + filename) block_blob_service = BlockBlobService(account_name=app.config['AZURE_STORAGE_ACCOUNT'], account_key=app.config['AZURE_STORAGE_KEY']) block_blob_service.create_blob_from_bytes( 'doc', filename, file.read()) # updir = os.path.join(basedir, 'upload/') # file.save(os.path.join(updir, filename)) # file_size = os.path.getsize(os.path.join(updir, filename)) return jsonify(name=filename, url='https://'+app.config['AZURE_STORAGE_ACCOUNT']+'.blob.core.windows.net/' \ +app.config['AZURE_STORAGE_CONTAINER']+'/'+filename)