search

Home  >  Q&A  >  body text

javascript - 求教:当使用webuploader上传图片时,服务器响应数据内容格式是什么

我前端使用百度的webUploader上传插件来上传图片,而后端使用Thinkphp来接收文件数据,但如果我后端接收文件出错时,该如何返回数据通知前端调用uploadError事件回调方法执行呢?

我看了官方文档,没有说明。。。。我试了很多数据格式,但前端依然执行uploadSuccess事件方法。。。特此求助下,成功是该返回什么数据格式,失败是该返回什么数据格式?

过去多啦不再A梦过去多啦不再A梦2739 days ago585

reply all(1)I'll reply

  • 为情所困

    为情所困2017-05-16 13:10:47

    Here’s a method for your reference:
    The server returns json. There is a status in the returned json to indicate whether the upload was successful. The front end should determine whether the server upload is successful in the uploadSuccess callback.

    The uploadError event should be triggered when the server status code is wrong. For example, the server returns 500

    reply
    0
  • Cancelreply