Skip to content
This repository has been archived by the owner on May 8, 2021. It is now read-only.

1. 后端处理

think2011 edited this page Mar 27, 2016 · 5 revisions

有两种方式,建议用【方式一】

方式一

  • 也就是标准的文件上传方式,而且这种方式传输量也会小一些

  • 前端发送rst.formData给后端

  • 后端接收 rst.file(可配置)字段,接着按常规处理

  • 这是一个基于 node 的上传示例 https://github.com/think2011/koa-upload

方式二

  • 发送base64字符串,接着处理字符串为图片即可。

  • 具体请使用关键字base64 转 image 开发语言进行google、baidu。

备注

建议前端发送一下rst.fileLen字段,后端进行校验来防止文件没有完整传送。