标题:求助高手!批量上传图
取消只看楼主
wangjy500
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:13
帖 子:457
专家分:2569
注 册:2010-7-11
结帖率:83.33%
已结贴  问题点数:100 回复次数:3 
求助高手!批量上传图
这是文件!上传的图片如何显示?
SwfUpload.rar (234.06 KB)
搜索更多相关主题的帖子: 图片 
2011-01-10 22:42
wangjy500
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:13
帖 子:457
专家分:2569
注 册:2010-7-11
得分:0 
可以正常下载啊!
上传代码:
程序代码:
<%
    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 
上传成功后,图片打开后都是这样:
------------gL6KM7ei4Ef1ei4Ij5Ef1ae0gL6Ij5
Content-Disposition: form-data; name="Filename"

SP_A0503.jpg
------------gL6KM7ei4Ef1ei4Ij5Ef1ae0gL6Ij5
Content-Disposition: form-data; name="Filedata"; filename="SP_A0503.jpg"
Content-Type: application/octet-stream


QQ:63572063
2011-01-11 18:10
wangjy500
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:13
帖 子:457
专家分:2569
注 册:2010-7-11
得分:0 
知道啊

QQ:63572063
2011-01-12 21:18
wangjy500
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:13
帖 子:457
专家分:2569
注 册:2010-7-11
得分:0 
你下载下来去研究下就晓得了

QQ:63572063
2011-01-13 21:05



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-330916-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.124989 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved