strFileName = Request.QueryString("file1") Set objStream = Server.CreateObject("ADODB.Stream") objStream.Type = 1 ' adTypeBinary objStream.Open objStream.LoadFromFile strFileName objStream.SaveToFile Server.mappath("123_onweb.gif"),2 |
<form name="FORM" action="upload.asp" method="post"> <input type="file" name="file1" value=""> <input type="submit" name="submit" value="OK"> </form> |
<% Function GetFileName(ByVal strFile) If strFile <> "" Then GetFileName = mid(strFile,InStrRev(strFile, "/")+1) Else GetFileName = "" End If End function strFileName = Request.Form("file1") Set objStream = Server.CreateObject("ADODB.Stream") objStream.Type = 1 ' adTypeBinary objStream.Open objStream.LoadFromFile strFileName objStream.SaveToFile Server.MapPath(GetFileName(strFileName)),2 objStream.Close %> |
新闻热点
疑难解答