he hoi
ik gebruikt deze asp pagina om jpg bestanden te downloaden
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
if(Request("wat") <> "") then wat__varwat = Request("wat")
%>
<%
FileName = wat__varwat
' Constants for Reading Text File
Const ForAppending = 8
Const ForReading = 1
Const ForWriting = 2
Const TristateFalse = 0
Const TristateMixed = -2
Const TristateTrue = -1
Const TristateUseDefault = -2
' File System Objects
Dim FSO
Dim TS
' Server File (this is the REAL name of the file)
Dim strFile: strFile = Server.MapPath("../../visuals/afbeeldingen/"&(Filename))
' File to Save As (this is the name you want to tell the browser)
Dim strFileSave: strFileSave = Filename
' Tell Browser what the file name is, so it doesn't try to save as "default.asp"
Call Response.AddHeader("Content-Disposition","attachment; filename=""" & strFileSave & """")
' Write out content-type that will FORCE user to SAVE FILE.
' "image/gif" will display in browser
Response.ContentType = "bad/type"
' Initialize File System Object
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
' Open TextStream for Reading
Set TS = FSO.GetFile(strFile).OpenAsTextStream(ForReading,TristateTrue)
' TS.ReadAll DOES NOT WORK. Every Byte must be read and written individually.
' I think you can read them in Chucks, but this was easier. If you know how to
' Read chunks... go ahead, read chunks
Do While Not (TS.AtEndOfStream)
' Output MUST be BinaryWrite
Response.BinaryWrite(TS.Read(1))
Loop
' Cleanup, like all good programmers do.
TS.Close
Set TS = Nothing
Set FSO = Nothing
' You don't need this, but I like it.
Response.End
%>
alleen werkt het nu niet meer. wat hij dus wel heeft gedaan, het enigste wat veranderd is dat de directory naam van de directory die in de wwwroot staan en waarin in de webpagina weer staat. wanneer ik deze weer terug verander blijf het probleem.
oja ik gebruik een ISS server
ik gebruikt deze asp pagina om jpg bestanden te downloaden
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
if(Request("wat") <> "") then wat__varwat = Request("wat")
%>
<%
FileName = wat__varwat
' Constants for Reading Text File
Const ForAppending = 8
Const ForReading = 1
Const ForWriting = 2
Const TristateFalse = 0
Const TristateMixed = -2
Const TristateTrue = -1
Const TristateUseDefault = -2
' File System Objects
Dim FSO
Dim TS
' Server File (this is the REAL name of the file)
Dim strFile: strFile = Server.MapPath("../../visuals/afbeeldingen/"&(Filename))
' File to Save As (this is the name you want to tell the browser)
Dim strFileSave: strFileSave = Filename
' Tell Browser what the file name is, so it doesn't try to save as "default.asp"
Call Response.AddHeader("Content-Disposition","attachment; filename=""" & strFileSave & """")
' Write out content-type that will FORCE user to SAVE FILE.
' "image/gif" will display in browser
Response.ContentType = "bad/type"
' Initialize File System Object
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
' Open TextStream for Reading
Set TS = FSO.GetFile(strFile).OpenAsTextStream(ForReading,TristateTrue)
' TS.ReadAll DOES NOT WORK. Every Byte must be read and written individually.
' I think you can read them in Chucks, but this was easier. If you know how to
' Read chunks... go ahead, read chunks
Do While Not (TS.AtEndOfStream)
' Output MUST be BinaryWrite
Response.BinaryWrite(TS.Read(1))
Loop
' Cleanup, like all good programmers do.
TS.Close
Set TS = Nothing
Set FSO = Nothing
' You don't need this, but I like it.
Response.End
%>
alleen werkt het nu niet meer. wat hij dus wel heeft gedaan, het enigste wat veranderd is dat de directory naam van de directory die in de wwwroot staan en waarin in de webpagina weer staat. wanneer ik deze weer terug verander blijf het probleem.
oja ik gebruik een ISS server