Upload function is not implemented with component (English NT) 2.

Source: Internet
Author: User
Tags servervariables
'----file name/handld_upload.asp

<% Option Explicit%>

<%
Response.expires=0
Response.Buffer = TRUE
Response.Clear
Const image_size = "width=" "height=" "150" ""
Dim Uploadrequest
Set uploadrequest = Server.CreateObject ("Scripting.Dictionary")

Dim ByteCount, Requestbin
ByteCount = Request.TotalBytes
Requestbin = Request.BinaryRead (ByteCount)

Builduploadrequest Requestbin

Dim Saveurl, Gourl, filepathname, value, filename
'----Save path
' Saveurl = Uploadrequest.item ("Saveurl"). Item ("Value")
Saveurl = "/"

'----Jump to file path when finish upload
Gourl = Uploadrequest.item ("Gourl"). Item ("Value")

Filepathname = Uploadrequest.item ("My_file"). Item ("Filepathname")
Value = Uploadrequest.item ("My_file"). Item ("Value")
filename = right (Filepathname,len (filepathname)-instrrev (filepathname, "\")

'----Debug
' Response.Write saveurl& ' * * &goURL& "* *" &filepathname
' Response.Write ' * * &filename
' Response.End

Dim FSO, MyFile, I
Set FSO = Server.CreateObject ("Scripting.FileSystemObject")
If not FSO. FolderExists (Server.MapPath (saveurl) & "\") Then
Recmkdir (Server.MapPath (saveurl) & "\")
End If
Set MyFile = fso. CreateTextFile (Server.MapPath (saveurl) & "\" & filename)

For i = 1 to LenB (value)
Myfile.write chr (AscB (MidB (value,i,1))
Next

Myfile.close

Session ("storedfile") = filename
Session ("strimage") = " "

Response.Redirect Gourl
%>
<!--#include file= "upload.asp"-->

'----file name/test.asp/
<% Option Explicit%>

<%
On Error Resume Next
Response.Expires = 0
Response.AddHeader "Pragma", "No-cache"

Dim Thisfile
Thisfile = Right (Request.ServerVariables ("Path_info"), Len (Request.ServerVariables ("Path_info"))-instrrev ( Request.ServerVariables ("Path_info"), "/")

If Request ("Imagecancel") <> "Then
Session ("storedfile") = ""
Session ("strimage") = ""
End If
%>
<title>Corp2Net.com</title>
<script language= "JavaScript" src= "/admin.js" ></script>
<script language= "JavaScript" >
<!--
function UpLoad (obj)
{
if (Obj.my_file.value.length < 7)
return false;
return true;
}
-->
</script>
<body link=<%= color_nl_1%> alink=<%= color_al_1%> vlink=<%= color_vl_1%> bgcolor=<%= COLOR_BG _1%>>
<font color= "<%= c_wd_content_4%>" >
Only upload <b>*.jpg</b> or <b>*.gif</b> file!
<br>
Otherwise, image may don't show correctly!
</font>
<center>
<table>
<% If (Len ("Strimage") > 0) Then%>
<tr>
<td>
<table border= "1" bordercolor= "<%= c_wd_t_border%>" cellspacing= "0" cellpadding= "0" <%= IMAGE_SIZE,%> >
<tr>
<td><%= session ("Strimage")%></td>
</tr>
</table>
</td>
</tr>
<% Else%>
<tr>
<td>
&n



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.