1

This is an easy Html.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form method="POST" action="https://sm.ms/api/upload" enctype="multipart/form-data">
    <input name="smfile" type="file">
    <input type="submit" name="upload">
</form>
</body>
</html>

When i post an image to the server(third party) , the server(third party) returned the json and changed my web..

{
  code: "success",
    data: {
      width: 440,
      height: 440,
      filename: "timg.jpg",
      storename: "5a7b1807506b2.jpg",
      size: 11941,
      path: "/2018/02/07/5a7b1807506b2.jpg",
      hash: "m8FqIYBGWL1HDrT",
      timestamp: 1518016519,
      ip: "111.29.138.47",
      url: "https://i.loli.net/2018/02/07/5a7b1807506b2.jpg",
      delete: "https://sm.ms/delete/m8FqIYBGWL1HDrT"
    }
}

my question is how to POST this json to my background and how to don't change my web ..

xojisi
  • 23
  • 1
  • 3
  • 1
    Please see the duplicate for your solution. Also, I'd suggest double checking that the API you're calling supports cross-domain JS requests using CORS. If not you will be prevented from achieving what you require by the Same Origin Policy – Rory McCrossan Feb 07 '18 at 16:08

0 Answers0