<script language=javascript>
window.location.href="http://yourserver/path/file"
</script>

解决方案 »

  1.   

    这要在服务器端实现<%
    Const ForReading=1
    Const TristateTrue=-1 'Unicode
    Const FILE_TRANSFER_SIZE=16384 '16k'Use the following line for IIS4/PWS - this is the default for IIS5
    Response.Buffer = TrueFunction TransferFile(path, mimeType, filename)
    Dim objFileSystem, objFile, objStream
    Dim char
    Dim sent
    send=0
    TransferFile = TrueSet objFileSystem = Server.CreateObject("Scripting.FileSystemObject")
    Set objFile = objFileSystem.GetFile(Path)
    Set objStream = objFile.OpenAsTextStream(ForReading, TristateTrue)Response.AddHeader "content-type", mimeType
    response.AddHeader "Content-Disposition","attachment;filename="&filename 
    Response.AddHeader "content-length", objFile.SizeDo While Not objStream.AtEndOfStream
        char = objStream.Read(1)
        Response.BinaryWrite(char)
        sent = sent + 1
        If (sent MOD FILE_TRANSFER_SIZE) = 0 Then
            Response.Flush
            If Not Response.IsClientConnected Then
                TransferFile = False
                Exit Do
            End If
        End If
    LoopResponse.Flush
    If Not Response.IsClientConnected Then TransferFile = FalseobjStream.Close
    Set objStream = Nothing
    Set objFileSystem = Nothing
    End FunctionDim path, mimeType, sucess
    'Server.MapPath(path)
    path = "C:\aa.doc"
    mimeType = "application/x-msdownload" 
    sucess = TransferFile(path, mimeType,"cdd.doc")
    Response.End
    %> 
      

  2.   

    是不是哪儿搞错了,执行以后会这样邢唷?>? "$?!欹5@ 餜bjbj??2璛璛dddd p S???????????????ER?>????????? ???????????????| 牊熠?d? ??#0S??????? ??????????$@$?@Test  hY_o( h|ko(gdY_01?2P皞. 捌A!?"?#悹$悹%癝班 惄N@?N ck噀 $1$a$$CJKHPJ_HaJmH nHsH tH$A?$ 貫祂=刉[SOBi?B nf恏?h?4? l4?a? k? 鄀Rh0€€O90€hondyY_|k@@@UnknownG?噝 €Times New Roman5?€Symbol3&? 噝 €Arial;??媅SOSimSun ???h*df.df!-!),.:;?]}??    & 6"0000 0 0 00000  =@\]^?([{  0 0 00000;[???個rH(???Y_hondyhondy?鄥燆鵒h珣+'迟0T    (4<DL?sshondyfond Normal.dothondy.d4ndMicrosoft Word 10.0@寙G@<択脍?@T燏脍??胀諟.摋+,0 X`px€ ?infoxfoA ? ?? ??#???Root Entry F? 熠?%€1Table WordDocument2SummaryInformation(DocumentSummaryInformation8CompObjf??  FMicrosoft Word 文档 MSWordDocWord.Document.8?瞦
      

  3.   

    mimeType = "application/x-msdownload" 
    改成
    mimeType = "application/octec-stream" 
    试试看?
      

  4.   

    谢谢了,可以加分,你等着吧
    不过希望你能解释一下
    x-msdownload
    octec-stream
    之含义
    如果能全程解真的非常感谢了。