尝试添加图像时出现 Microsoft VBScript 运行时错误“800a0034”

Microsoft VBScript runtime error '800a0034' when trying to add image

我不是编码员,我在一个旧的 asp 网站上工作,并且有一个页面可以将图像上传到给定页面(从下拉列表中),但是当我尝试将图像添加到相应的页面我得到这个错误,我猜从一开始就存在。

Microsoft VBScript 运行时错误“800a0034” 错误的文件名或编号 /path-to-file/foto.asp,第 105 行

相关代码是这样的

'Create and Write to a File
Randomize()
strChiave = Cstr(Right(DatePart("yyyy", Date()),2))
strChiave = strChiave + Cstr(DatePart("y", Date()))
strChiave = strChiave + Replace(Time(),".","")
strChiave = strChiave + Right(Session.SessionID,4)
strChiave = strChiave + CSTR(INT(RND()*1000))
strImmagine = strChiave + Right(filename,4)
Set MyFile = ScriptObject.CreateTextFile(Application("path_public") & "/" & strImmagine)

For i = 1 to LenB(value)
MyFile.Write chr(AscB(MidB(value,i,1)))
Next
MyFile.Close

第 105 行是这样的

Set MyFile = ScriptObject.CreateTextFile(Application("path_public") & "/" & strImmagine)

谢谢

Time() 方法 returns 具有这种结构的时间:HH:mm 其中 "HH" 是小时,"mm" 是分钟。如您所见,它包含一个冒号字符,而不是一个点,并且冒号在文件路径中无效。

更改代码中的这一行:

strChiave = strChiave + Replace(Time(),".","")

改为:

strChiave = strChiave + Replace(Time(),":","")