jQuery-File-Upload Classic-ASP

hak*_*man 3 asp-classic jquery-html5uploader jquery-file-upload

我认为 jQuery-File-Upload插件界面很棒,功能齐全!我非常喜欢它!但我的服务器是经典ASP iis ...现在我想使用jQuery-File-Upload来上传文件(图像文件).请帮助我thx!

在我的服务器上我有3个文件,上传工作正常!现在我想添加像index.asp这样的html5文件.并使用jQuery-File-Upload basic-plus us.我需要进度条,验证,预览图像和客户端图像大小调整.也许太复杂了.

也许我们只是编辑"jQuery-File-Upload/index.html"

  <form id="fileupload" action="http://myserver.com/html5/upload.asp" method="POST" enctype="multipart/form-data">
Run Code Online (Sandbox Code Playgroud)

我希望有人指导我.

请帮助我thx!抱歉我的英文...

3个文件/html5/index.asp

    <!DOCTYPE html>
    <html>
    <head>
     <meta charset="gbk" />
     <title>fileReader?????????</title>
    </head>
    <body>
    ?????<br />
    <form action="upload.asp" method="post" enctype="multipart/form-data">
     <p>
???<input type="text" name="form1" value="form1_text" /><br />
        ???<input type="file" id="file" name="file1" multiple />
<input type="submit" value="??" />
        </p>
        <div name="result" id="result">
        </div>
    </form>
    </body></html>
Run Code Online (Sandbox Code Playgroud)

2 /html5/index.asp

 <!--#include file="UpLoad_Class.asp"-->
<%
dim upload
 set upload = new AnUpLoad
upload.Exe = "*"
upload.MaxSize = 2 * 1024 * 1024 '2M
upload.GetData()
if upload.ErrorID>0 then 
response.Write upload.Description
 else
dim file,savpath
savepath = "upload"
for each frm in upload.forms("-1")
    response.Write frm & "=" & upload.forms(frm) & "<br />"
next

set file = upload.Files("file1")
if file.isfile then
    result = file.saveToFile(savepath,0,true)
    if result then
        response.Write "??'" & file.LocalName & "'?????????'" & server.MapPath(savepath & "/" & file.filename) & "',????" & file.size & "??<br />"
    else
        response.Write file.Exception & "<br />"
    end if
end if

set file = upload.Files_Muti("file1",1)
if file.isfile then
    result = file.saveToFile(savepath,1,true)
    if result then
        response.Write "??'" & file.LocalName & "'?????????'" & server.MapPath(savepath & "/" & file.filename) & "',????" & file.size & "??<br />"
    else
        response.Write file.Exception & "<br />"
    end if
end if

Response.Write "??????????" & Upload.QuickSave("file1",savepath) & "?"
end if
set upload = nothing
%>
Run Code Online (Sandbox Code Playgroud)

和3 /html5/UpLoad_Class.asp它的代码太多了

<%
Dim StreamT
Class AnUpLoad
Private Form, Fils
Private vCharSet, vMaxSize, vSingleSize, vErr, vVersion, vTotalSize, vExe,  vErrExe,vboundary, vLostTime, vMode, vFileCount,StreamOpened
private vMuti,vServerVersion
Public Property Let Mode(ByVal value)
    vMode = value
End Property

Public Property Let MaxSize(ByVal value)
    vMaxSize = value
End Property

Public Property Let SingleSize(ByVal value)
    vSingleSize = value
End Property

Public Property Let Exe(ByVal value)
    vExe = LCase(value)
    vExe = replace(vExe,"*.","")
    vExe = replace(vExe,";","|")
End Property

Public Property Let CharSet(ByVal value)
    vCharSet = value
End Property

Public Property Get ErrorID()
    ErrorID = vErr
End Property

Public Property Get FileCount()
    FileCount = Fils.count
End Property

Public Property Get Description()
    Description = GetErr(vErr)
End Property

Public Property Get Version()
    Version = vVersion
End Property

Public Property Get TotalSize()
    TotalSize = vTotalSize
End Property

Public Property Get LostTime()
    LostTime = vLostTime
End Property
...................................ect ...i think you guys knows
Run Code Online (Sandbox Code Playgroud)

Fer*_*ais 5

我自己对jQuery-File-Upload感到有些困惑,但在查看插件文档之后,我发现插件在Classic ASP环境中工作需要什么.

  1. 你必须有一个上传组件,它不是在裸IIS设置上提供的(你可以在服务器上使用Persits中的AspUpload,或者FreeAspUpload这是一个无DLL的组件,因此可以在任何经典ASP服务器上使用) .

  2. 您必须设置上传脚本以编写上传的文件,并按插件文档中的定义向插件返回有效的JSON响应:https://github.com/blueimp/jQuery-File-Upload/wiki/Setup#using -jquery文件上传的UI版本上带有一个定制的服务器端上传处理程序

在我使用JSON响应设置上传脚本后,该插件正常工作.

祝好运!

费尔迪