# 上传-图片

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /api/uploadimg:
    post:
      summary: 上传-图片
      deprecated: false
      description: |-
        上传-图片

        注意1：上传的图片必须在2MB以内
        注意2：服务器端oss（阿里云对象存储）为了安全性，图片url网址不能直接在浏览器地址栏访问
        请用img/背景图方式进行使用
      tags:
        - 图片上传
        - AJAX编程/头像上传
      parameters: []
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                img:
                  description: 图片文件(2MB以内)
                  example: ''
                  type: string
                  format: binary
              required:
                - img
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    title: 业务状态码
                    description: 10000成功, 其他失败
                  message:
                    type: string
                    title: 响应消息
                  data:
                    type: string
                    title: 响应数据
                    description: 上传成功的图片-在线地址
                required:
                  - code
                  - message
                  - data
                x-apifox-orders:
                  - code
                  - message
                  - data
              example:
                message: 上传成功
                data:
                  url: >-
                    http://yjy-teach-oss.oss-cn-beijing.aliyuncs.com/ajax/16761891466140.7797740766205927.png
          headers: {}
          x-apifox-name: 成功
        '400':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    title: 响应消息
                  data:
                    type: string
                    title: 响应结果
                required:
                  - message
                  - data
                x-apifox-orders:
                  - message
                  - data
              example: <h2>400 Bad Request</h2>
          headers: {}
          x-apifox-name: 文件类型错误
        '413':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    title: 业务状态码
                    description: 10000成功, 其他失败
                  message:
                    type: string
                    title: 响应消息
                  data:
                    type: string
                    title: 响应数据
                required:
                  - code
                  - message
                  - data
                x-apifox-orders:
                  - code
                  - message
                  - data
          headers: {}
          x-apifox-name: 文件-超出限制大小
      security: []
      x-apifox-folder: 图片上传
      x-apifox-status: released
      x-run-in-apifox: https://app.apifox.com/web/project/1937884/apis/api-49760221-run
components:
  schemas: {}
  securitySchemes: {}
servers: []
security: []

```
