Question: I want to upload the file renamed after the download, and then change the name back.
For example: I upload a "my photos. jpg" uploaded to the system after the number of "20040302001.jpg" download and then changed back to "my photos. jpg"
Both the old and new file names are in the database (done)
is to download the name of the change does not come out.
Code:
Copy Code code as follows:
<%
function dl (f,n)
On Error Resume Next
Set s=createobject ("ADODB.stream")
S.mode=3
S.type=1
S.open
S.loadfromfile (f)
If err.number> 0 Then
response.status= "404"
Else
Response.contenttype= "Application/octet-stream"
Response.AddHeader "Content-disposition:", "attachment; Filename= "& N
Range=mid (Request.ServerVariables ("Http_range"), 7)
If range= "" Then
Response.BinaryWrite (S.read)
Else
S.POSITION=CLNG (Split (Range, "-") (0))
Response.BinaryWrite (S.read)
End If
End If
Response.End
End Function
%>
function Usage Examples:
Copy Code code as follows:
Call DL (Server.MapPath ("download/20040302001.jpg"), "my photos. jpg")