3

I think jQuery-File-Upload plug-in interface is great, fully functional! I like it very much! but my server is Classic ASP iis... now i want to use the jQuery-File-Upload to upload file (image files). please help me thx!

on my server i got 3 files and the uploader work fine! now i want add html5 file like index.asp . and usejQuery-File-Upload basic-plus us . i need progress bar, validation , preview images and client-side image resizing . Perhaps too complicated.

maybe we just edit "jQuery-File-Upload/index.html"

  <form id="fileupload" action="http://myserver.com/html5/upload.asp" method="POST" enctype="multipart/form-data">

I hope someone guide me.

please help me thx! and sorry for my English...

3 files /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>

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
%>

and 3 /html5/UpLoad_Class.asp it`s too much code

<%
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
hakaman
  • 41
  • 1
  • 1
  • 4
  • 1
    I've just downloaded the zip file from the jQuery-File-Upload page. It doesn't come with an asp handler script equivalent to the php one, so you would probably have to take the php files which from the the zip file and rewrite them in Classic ASP. There are asp scripts which have some of the functionality you are asking for, have a look at this - http://www.uploadify.quickersite.com/. Alternatively, your IIS server should support PHP and may even have it installed already, so maybe you could just use the php handler script as is. – John Oct 21 '13 at 17:06
  • thanks john! my server only support asp classic.... so i may need to translate the php to asp ... but it`s to difficult for me. -_-!! – hakaman Oct 22 '13 at 02:17
  • Unfortunately, unless you're prepared to get deep into the hairy innards of your server, translating any of the existing code into classic ASP will fall firmly into the realm of Not Easy(TM). You need to look for an upload utility that is designed to work with classic ASP. (The only one I know of these days is Persits' AspUpload.) – Martha Nov 05 '13 at 03:06

1 Answers1

5

I was a little confused with jQuery-File-Upload myself, but after reviewing the plugin documentation I found what is needed for the plugin to work on Classic ASP environment.

  1. You must have an upload component, which is not provided on a bare IIS setup (you may use AspUpload from Persits if it is available on your server, or FreeAspUpload which is a DLL-free component so may be used on any Classic ASP server).

  2. You must setup your upload script to write the uploaded file, AND return a valid JSON response to the plugin, as defined on the plugin documentation: https://github.com/blueimp/jQuery-File-Upload/wiki/Setup#using-jquery-file-upload-ui-version-with-a-custom-server-side-upload-handler

After I set up the upload script with the JSON response, the plugin worked correctly.

Good Luck!

Ferdi