首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >jQuery-文件-上传经典-ASP

问jQuery-文件-上传经典-ASP
EN

Stack Overflow用户
提问于 2013-10-21 16:39:30
回答 1查看 10.3K关注 0票数 3

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

在我的服务器上,我有3个文件和上传工作良好!现在,我需要添加像index.asp这样的index.asp文件。使用jQuery-文件上传basic+我们。我需要进度条,验证,预览图像和客户端图像调整.也许太复杂了。

也许我们只是编辑“/index.html”

代码语言:javascript
复制
  <form id="fileupload" action="http://myserver.com/html5/upload.asp" method="POST" enctype="multipart/form-data">

我希望有人指引我。

请帮帮我!为我的英语道歉..。

3个文件/html5 5/index.asp

代码语言:javascript
复制
    <!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>

2/html5 5/index.asp

代码语言:javascript
复制
 <!--#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
%>

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

代码语言:javascript
复制
<%
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
EN

回答 1

Stack Overflow用户

发布于 2013-11-16 16:36:08

我对jQuery感到有点困惑,但在查看了插件文档之后,我发现了插件在经典ASP环境下工作所需的内容。

  1. 您必须有一个上传组件,它不是在单独的IIS设置中提供的(如果AspUpload在您的服务器上可用,您可以使用它,或者可以在任何经典ASP服务器上使用无DLL的FreeAspUpload组件)。
  2. 您必须设置您的上传脚本来编写上传的文件,并向插件返回一个有效的JSON响应,正如插件文档:https://github.com/blueimp/jQuery-File-Upload/wiki/Setup#using-jquery-file-upload-ui-version-with-a-custom-server-side-upload-handler中定义的那样

在我用JSON响应设置了上传脚本之后,插件就正常工作了。

祝好运!

费迪

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19500101

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档