Keresés

Új hozzászólás Aktív témák

  • sziszegőII

    tag

    válasz ízirider #140 üzenetére

    Találtam jobbat. Mármint ingyeneset.
    ASPBrowser a neve
    !-- ------------------------------------------------------------------------- -->
    <!-- ASPBROWSER v1.0 (06-2004) -->
    <!-- ------------------------------------------------------------------------- -->
    <!-- Copyright (C) 2004 AVRIL CONSEIL -->
    <!-- http://www.avril-conseil.com -->
    <!-- ------------------------------------------------------------------------- -->
    <!-- This program is free software; you can redistribute it and/or modify -->
    <!-- it under the terms of the GNU General Public License as published by -->
    <!-- the Free Software Foundation; either version 2 of the License, or -->
    <!-- (at your option) any later version. -->
    <!-- ------------------------------------------------------------------------- -->

    <%
    call downloadFile(Request.querystring(''file''))


    function downloadFile(strFile)
    dim ads, fso, f

    'empties buffer
    Response.Buffer = True
    Response.Clear

    'create a stream (check you have last MDAC version installed)
    set ads = Server.CreateObject(''ADODB.Stream'')
    ads.Open
    ads.Type = 1

    on error resume next

    set fso = Server.CreateObject(''Scripting.FileSystemObject'')
    if not fso.FileExists(strfile) then
    Response.Write ''<h1>Erreur: </h1><font color='#485e9e'>'' & strfile & ''</font> n'existe pas<p>''
    Response.Write strfile
    Response.End
    end if

    set f = fso.GetFile(strfile)
    intFilelength = f.size

    ads.LoadFromFile(strfile)
    if err then
    Response.Write ''<h1>Erreur: </h1><font color='#485e9e'>'' & err.Description & ''</font><p>''
    Response.End
    end if

    'send header to browser
    Response.AddHeader ''Content-Disposition'', ''attachment; filename='' & f.name
    Response.AddHeader ''Content-Length'', intFilelength
    Response.Charset = ''UTF-8''
    Response.ContentType = ''application/octet-stream''

    'send file
    Response.BinaryWrite ads.Read
    Response.Flush

    ads.Close
    set ads = Nothing

    end function
    %>

    Bocsi kicsit hosszú, de jónak tűnik

Új hozzászólás Aktív témák