ASP code to determine if a remote picture exists

Source: Internet
Author: User

To determine whether a remote picture exists [ASP code]

function CheckURL(byval A_strUrl)
set XMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
XMLHTTP.open "HEAD",A_strUrl,false
XMLHTTP.send()
CheckURL=(XMLHTTP.status=200)
set XMLHTTP = nothing
end function
Dim imgurl
imgurl="UploadFiles/2007829144940734.gif"
if CheckURL(imgurl) then
response.write "图片存在"
else
response.write "图片不存在"
end if

To determine whether a remote picture exists [JS code]

{
var oReq = new ActiveXObject("Microsoft.XMLHTTP")
oReq.open("Get","UploadFiles/2007829144941621.gif",false);
oReq.send();
//alert(oReq.status)
if(oReq.status==404)
alert('不存在');
else
alert("存在")
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.