Q: I want to change the name after uploading the file, and change the name after downloading.
For example, success"
The new and old file names are saved in the database (already done)
That is, the name of the downloaded file cannot be changed.
Code:Copy codeThe Code is 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 example:Copy codeThe Code is as follows: call dl (Server. MapPath ("download/20040302001.jpg"), "my photos .jpg ")