ASP upload Download

Source: Internet
Author: User
Tags file upload save file
Upload | download

Altogether 3 files

<--upfile.asp-->http://ktgirl001.0033.cn

<%option explicit%>
<%Server.ScriptTimeOut=5000%>
<!--#include file= "Upload_5xsoft.inc"-->
<title> File Upload </title>
<body>
<br> transformation File Upload!<%
Dim Upload,file,formname,formpath,icount
Set upload=new upload_5xsoft ' Build upload Object

Response.Write Upload. version& "<br><br>" shows the version of the uploaded class

If Upload.form ("filepath") = "then" gets uploaded directory
Htmend "Please enter the directory you want to upload!"
Set upload=nothing
Response.End
Else
Formpath=upload.form ("filepath")
"Add (/) to the directory
If Right (formpath,1) <> "/" Then formpath=formpath& "/"
End If

Icount=0
For every formName in Upload.objform ' Lists all form data
Response.Write formname& "=" &upload.form (formName) & "<br>"
Next

Response.Write "<br>"
For every formName in Upload.objfile ' lists all uploaded files
Set File=upload.file (formName) ' generates a File object
If file. Filesize>0 Then ' if FileSize > 0 indicates file data
File. SaveAs Server.MapPath (formpath&file. FileName) ' Save file
Response.Write file. Filepath&file. filename& "(" &file. filesize& ") =>" &formPath&File.FileName& "Success!<br>"
Icount=icount+1
End If
Set file=nothing
Next

Set Upload=nothing ' Deletes this object
Htmend icount& "File Upload end!"

Sub Htmend (MSG)
Set upload=nothing
Response.Write "<br>" &Msg& "[<a href=" "Javascript:history.back ();" " > Return </a>]</body>Response.End
End Sub
%>
</body>







Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.