search

Home  >  Q&A  >  body text

javascript - Ask for advice: When using webuploader to upload images, what is the format of the server response data content?

My front-end uses Baidu's webUploader upload plug-in to upload images, and the back-end uses Thinkphp to receive file data. But if my back-end receives an error when receiving files, how do I return the data to notify the front-end to call the uploadError event callback method?

I read the official documentation, but there is no explanation. . . . I tried many data formats, but the front end still executes the uploadSuccess event method. . . I would like to ask for help. What data format should be returned if successful and what data format should be returned if failed?

过去多啦不再A梦过去多啦不再A梦2784 days ago624

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