代码很简单
itm_image为image字段
itm_fname为图片文件名
代码语言:javascript复制Define Class ctl_image As SESSION
Procedure getfile
cfile=HttpQueryParams2("file")
CURSORSETPROP("MapBinary",.t.,0)
TEXT TO lcSQLCmd NOSHOW TEXTMERGE
SELECT itm_image FROM temp_itm_mstr_pic WHERE itm_fname=?cfile
ENDTEXT
oDBSQLHelper=NEWOBJECT("MSSQLHelper","MSSQLHelper.prg")
IF oDBSQLHelper.SQLQuery(lcSQLCmd,"temp_itm_mstr_pic")<0
RETURN ""
ENDIF
_currentcode="UTF-8"
setContentType("image/png")
RETURN "" temp_itm_mstr_pic.itm_image
ENDPROC
ENDDEFINE
浏览器调用
http://127.0.0.1:801/ctl_image.fsp?proc=getfile&file=文件名