【发布时间】:2021-10-24 08:40:42
【问题描述】:
我正在尝试验证图像 URL 并希望检查图像类型。我该怎么做?
假设这是图像 URL:“https://static.wayup.com/company_logo/95tJHraryb_20171220.png”
这些是支持的格式
const SUPPORTED_FORMATS = ["image/jpg", "image/jpeg", "image/png"];
这是我正在尝试对图像进行的验证
image: Yup.mixed()
.required("Please select Image")
.test("fileFormat", "Unsupported Format", (value) => {
How do i get the image type from the URL?
}),
[1]: https://static.wayup.com/company_logo/95tJHraryb_20171220.png
【问题讨论】:
-
你能显示你的代码吗?谢谢
标签: javascript reactjs yup