在我的网站上,我使用uploads.im(http://uploads.im/apidocs)让用户上传一张我在同一页面上显示的图片。我让用户通过此表单提交图片。
<form method="POST" action="http://uploads.im/api?upload&resize_width=350" enctype="multipart/form-data">
<input type="file" name="file" />
<input type="submit" value="Upload" name="submit">
</form>
当我上传图片时,我会收到以下JSON:
{
"status_code": 200,
"status_txt": "OK",
"data": {
"img_name": "FhXqn.jpg",
"img_url": "http:\/\/sk.uploads.im\/FhXqn.jpg",
"img_view": "http:\/\/uploads.im\/FhXqn.jpg",
"img_width": "350",
"img_height": 233,
"img_attr": "width=\"350\" height=\"233\"",
"img_size": "29.3 KB",
"img_bytes": 30051,
"thumb_url": "http:\/\/sk.uploads.im\/t\/FhXqn.jpg",
"thumb_width": 360,
"thumb_height": 240,
"source": "base64 image string",
"resized": "1",
"delete_key": "2c8b42a2daa7436b"
}
}
如何从此JSON获取图像URL,以便将其存储在我的MYSQL数据库中?我如何阻止用户看到此JSON并在上传后返回我的网站?