Chitika

Thursday, November 3, 2011

ASP file upload

Use following HTML for file upload:

  <form name="frmSend" method="POST" enctype="multipart/form-data" accept-charset="utf-8">
            Bulk Upload: <input name="bulkfile" type="file" />
            <input type="submit" value="Upload" / id=submit1 name=submit1>
</form>

Obtain zip file from http://www.freeaspupload.net/freeaspupload/download.asp. Extract it and place freeASPUpload.asp in the directory containing scripts.

I had to comment out /disable line 122

Open the script to have upload functionality and add following line:

'At start of script


<%@ Language=VBScript %>
<%

    Response.Expires = -1
    Server.ScriptTimeout = 600
    ' All communication must be in UTF-8, including the response back from the request
    Session.CodePage  = 65001

.
.
.
%>

'then

<!-- #include file="freeaspupload.asp" -->

Dim uploadsDirVar
 uploadsDirVar = Session("UploadPath")

            if Request.ServerVariables("REQUEST_METHOD") = "POST" then
           
                Dim Upload, origName, savName, fullName
               
                Set Upload = New FreeASPUpload
                Upload.SaveOne uploadsDirVar,0,origName,savName

No comments:

Post a Comment