Very good upload! No Components! File Upload! Contains additional text fields! Automatic renaming of Files! Simple and easy to use!

Source: Internet
Author: User
Upload | No components part of the code according to transformation code adaptation!!
Upload.htm



<meta http-equiv= "Content-language" content= "ZH-CN" >
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<meta name= "generator" content= "Microsoft FrontPage 4.0" >
<meta name= "ProgId" content= "FrontPage.Editor.Document" >
<title>new Page 1</title>
<link rel= "stylesheet" href= ". /public/css.css ">

<script language= "JavaScript" >
<!--
function Checkform1 ()
{

if (form1.names.value== "")
{
Alert ("Please enter a name!") ")
Form1.names.focus ()
return False
}
if (form1.pic.value== "")
{
Alert ("Please select a picture!") ")
Form1.pic.focus ()
return False
}
return True
}

-->
</script>
<body>

<table border= "0" width= "100%" >
<form name= "Form1" enctype= "Multipart/form-data" action= "upload.asp" method= "POST" onsubmit= "return Checkform1 ()" >
<tr>
&LT;TD width= "100%" colspan= "2" >
<p align= "center" ><b> Upload Example </b></td>
</tr>

<tr>
&LT;TD width= "40%" align= "right" > name:</td>
&LT;TD width= "60%" ><input type= "text" name= "names" size= "maxlength=" class= "" INPUT1 "></td>
</tr>
<tr>
&LT;TD width= "40%" align= "right" > Pattern:</td>
&LT;TD width= "60%" ><input type= "file" name= "pic" size= "" maxlength= "" class= "input1" "onblur=" Document.all.picview.src=document.all.pic.value "></td>
</tr>

<tr>
&LT;TD width= "40%" align= "right" > </td>
&LT;TD width= "60%" ><input type= "Submit" value= "O K" class= "inputbtn" ></td>
</tr>
<tr>
&LT;TD width= "100%" align= "center" colspan= "2" >
Image Preview (after selecting a picture, click anywhere on the page to preview) <br>

</td>

</tr>
</form>
</table>

</body>




-----upload.asp
<!--#include file= "savefile.asp"-->
<%
Set objstream = Server.CreateObject ("ADODB. Stream ")

Objstream.mode=3
objStream.Type = 1
objStream.Open

Objstream.write Request.BinaryRead (request.totalbytes)

names= GetValue ("names", True, "")

Pic=getvalue ("Pic", False, "upimg/")


objStream.Close
Response.Write ("names:" +names)
Response.Write ("File uploaded!") +pic+ ")")
%>


-----savefile.asp
<%
Dim Stream1,stream2,istart,iend,filename
Istart=1
VBENTER=CHR (&AMP;CHR) (10)

function GetValue (fstr,foro,paths) ' Fstr for received name, Foro boolean false for file upload, true to normal field, path for upload file
If Foro Then
Getvalue= ""
Istart=instring (ISTART,FSTR)

Istart=istart+len (FSTR) +5
Iend=instring (istart,vbenter+ "-------------------



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.