求助高手!批量上传图
这是文件!上传的图片如何显示?
SwfUpload.rar
(234.06 KB)
<% Dim biData, PostData Size = Request.TotalBytes biData = Request.BinaryRead(Size) PostData = BinaryToString(biData,Size) Dim Exc If InStr(UCase(PostData),".JPG") > 0 Then Exc = ".jpg" ElseIf InStr(UCase(PostData),".GIF") > 0 Then Exc = ".gif" ElseIf InStr(UCase(PostData),".PNG") > 0 Then Exc = ".png" ElseIf InStr(UCase(PostData),".BMP") > 0 Then Exc = ".bmp" Else Exc = ".xxl" End If Dim FileName,Rndum,DateStr,FileFolder FileFolder="../"&Trim(Request.QueryString("FileFolder")) Randomize Rndum = Int((999 * Rnd) + 100) DateStr = Replace(Replace(Replace(Now(),"-",""),":","")," ","") FileName = DateStr & Rndum Set bSourceData = createobject("ADODB.Stream") bSourceData.Open bSourceData.Type = 1 bSourceData.Write biData bSourceData.SaveToFile Server.MapPath(FileFolder&"/"&FileName & Exc),2 Function BinaryToString(biData,Size) Const adLongVarChar = 201 Set RS = CreateObject("ADODB.Recordset") RS.Fields.Append "mBinary", adLongVarChar, Size RS.Open RS.AddNew RS("mBinary").AppendChunk(biData) RS.Update BinaryToString = RS("mBinary").Value RS.Close End Function上传成功后,图片打开后都是这样: