search

Home  >  Q&A  >  body text

Xiaobai's help post. Please help with the problem of passing token parameters in the header.

This is a picture bed interface. The first step is to verify the user. The returned data is successful.

{"code":200,"msg":"success", "data":{"token":"8961576c9090ef0902c4b89406f8d557"},"time":1560559347}

There is no problem with header parameter passing in the next step, please give me some guidance.


The second step is to upload the image. If there is a parameter token in the header during the request, the interface will authenticate the token, and the uploaded image will also be under the token user, otherwise the upload will fail.

The upload request method is post

url: https://domain name/api/upload

Request parameters

Parameters Name Type

image file

Returns json

Upload example

POST /api/upload HTTP/1.1
Host: https://domain name
Connection: keep-alive
Content-Length: 57398
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryx2mqINKHVPJ8yMdK

--- ---WebKitFormBoundaryx2mqINKHVPJ8yMdK
Content-Disposition: form-data; name="image"; filename="test.png"
Content-Type: image/png


First, thank you

silversilver2041 days ago1082

reply all(0)I'll reply

No reply
  • Cancelreply