代码很简单,以下是判断文件不能超过200M
代码语言:javascript复制cFile=Getfile("jpg|png")
If !File(lcFile)
Return
Endif
ADIR(laarray,lcFile)
IF laarray[2]/1024>1024*200
MESSAGEBOX("文件不能超过200M",0 16,thisform.Caption)
RETURN
ENDIF
附HTTP文件上传代码(以后加上多线程上传功能)
代码语言:javascript复制lcUrl=Serverurl "ctl_file.fsp?proc=upload"
oQiyuUpload=Newobject("QiyuUploadFile","QiyuUploadFile.prg")
cReturn=oQiyuUpload.uploadfile(lcUrl,lcFile)
If ISNULL(cReturn)
Messagebox(oQiyuUpload.msg,0 16,Thisform.Caption)
Return
Endif
oReturn=foxjson_parse(cReturn)
IF oReturn.item("errno")!=0
MESSAGEBOX(oReturn.item("errmsg"),0 16,thisform.Caption)
RETURN
ENDIF
?"文件名",oReturn.item("filename")