You will have to use streaming--here is an example:
<%
Function downloadFile( strFile, strDownloadFilename )
Dim strFilename,objStream,objF
Dim intFileLength
' get full path of specified file
strFilename = FullPath
' clear the buffer
Response.Buffer = True
Response.Clear
' create stream
Set objStream = Server.CreateObject("ADODB
objStream.Open
' set as binary
objStream.Type = 1
' check the file exists
Set objFilesystem = Server.CreateObject("Scrip
if not objFilesystem.FileExists(s
Response.Write("<h1>Error<
Response.End
end if
' get length of file
Set objFilestream = objFilesystem.GetFile( strFilename )
intFilelength = objFilestream.size
objStream.LoadFromFile( strFilename )
if err then
Response.Write("<h1>Error:
Response.End
end if
'format strFileName
if Len( Trim(strDownloadFilename) ) > 0 then
strDownloadFilename = Trim( strDownloadFilename )
else
strDownloadFilename = objFilestream.name
end if
' Response.ContentType = "SENTREnet"
' send the headers to the users browser
Response.AddHeader "Content-Disposition", "attachment; filename=" & strDownloadFilename
Response.AddHeader "Content-Length", intFilelength
Response.Charset = "UTF-8"
dim i
for i = 0 to objFilestream.size
i = i + 128000
Response.BinaryWrite(objFi
Response.Flush
next
' output the file to the browser
'Response.BinaryWrite objStream.Read
'Response.Flush
' tidy up
objFilestream.Close
Set objFilestream = Nothing
End Function
%>
</HEAD>
<%
Call downloadFile( Replace( Request("FILE") ,"/","\"), Request("FILENAME") )
'Response.Write (Request("FILE") & "----" & Request("FILENAME") )
%>
Main Topics
Browse All Topics





by: Ayesha_KPosted on 2004-08-25 at 06:49:31ID: 11892287
if YOU can open your file through an application means any internet guest user can ... so that means security is as much as u have in wwwroot folder ....
you can have two solutions
1- keep you files in the database
2- copy the file you want to view in a temp folder in wwwroot ... view and after viewing ... delete the file from there
oh ... and a third solution ...
3- create a VB dll that access the PC as an admin or desktop user ... call the dll from your ASP page to open the file ... this way desktop will think that some desktop user is opening the file not the internet user.
Regards