注册 登录
编程论坛 ASP技术论坛

利用LoadPicture函数检查上传文件,更安全应该上传目录设置为没脚本。

ysf0181 发布于 2013-04-29 16:26, 664 次点击
定义和用法
LoadPicture 函数可返回一个图片对象。
可被 LoadPicture 函数识别的图形格式有:
bitmap 文件 (.bmp)
icon 文件 (.ico)
run-length encoded 文件 (.rle)
metafile 文件 (.wmf)
enhanced meta文件 (.emf)
GIF 文件 (.gif)
JPEG 文件 (.jpg)
注释:此函数仅供 32-位 平台。
语法
LoadPicture(picturename)
<%
Public Function GetImageSize(ByVal strPath)
    On Error Resume Next
    Dim img
    Set img = LoadPicture(strPath)
    If Err.Number Then
        Response.Write "图片装入错误:" & Err.Description
        Err.Clear
        GetImageSize = Array(0, 0)
        Exit Function
    End If
    GetImageSize = Array(img.Width, img.Height)
    Set img = Nothing
End Function

GetImageSize "E:\2.bmp"
%>
0 回复
1