code: def upload():
      
      build = g.build
      utils.jsonify_assert(len(request.files) == 1,
                           'Need exactly one uploaded file')
  
      file_storage = request.files.values()[0]
      data = file_storage.read()
      content_type, _ = mimetypes.guess_type(file_storage.filename)
  
      artifact = _save_artifact(build, data, content_type)
  
      db.session.add(artifact)
      db.session.commit()
  
      return flask.jsonify(
          success=True,
          build_id=build.id,
          sha1sum=artifact.id,
          content_type=content_type)
docs: Uploads an artifact referenced by a run.