웹 사이트에서 ASP Classic을 사용하고 있으며 사용자가 파일을 다운로드 할 수 있지만 파일 경로를 숨기는 스크립트에 문제가 있습니다.ASP 클래식 다운로드 파일 스크립트
사용자가 페이지에있을 때 링크가 표시됩니다. 링크는 다음과 같이 코딩됩니다.
<a href="download.asp?file=FILE-NAME-HERE" target="_blank">Download File</a>
이 링크는 코드를 실행하여 파일을 가져와 전달하는 download.asp 링크로 이동합니다. 여기 코드는 내가 지금 가지고 있습니다 :
<%
const adTypeBinary = 1
dim strFilePath, strFile
strFilePath = "/_uploads/private/"
strFile = Request.QueryString("file")
if strFile <> "" then
'Set the content type to the specific type that you are sending.
Response.ContentType = "application/octet-stream"
Response.AddHeader "Content-Disposition", "attachment; filename=" & strFile
set objStream = Server.CreateObject("ADODB.Stream")
objStream.open
objStream.type = adTypeBinary
objStream.LoadFromFile(strFilePath & strFile)
response.binarywrite objStream.Read
objStream.close
Set objStream = nothing
end if
%>
이 사이트 (How to download the files using vbscript in classic asp)에 두 질문에서 조립이 코드 및 http://support.microsoft.com/kb/276488
에서 무슨 일하지만, download.asp이다 페이지가 "/ _uploads/private /"웹 디렉토리에 올바르게 있어도 "file not found"오류를 표시합니다.
파일 형식은 PDF, XLS, DOCX을 포함, 여러 가지 중 하나가 될 수는
파일을 허용하지 않습니다 내 코드에 뭔가가 거기에 발견되는 등?
IIS에 해당 폴더에 대한 읽기 권한이 있습니까? –
예, "/ _uploads/private /"폴더의 현재 사용 권한 값은 755입니다. – user2762748
전체 드라이브 문자 + 경로를 사용해보십시오. –