2013-07-23 1 views
0
와 서버에 HTML에서 생성 된 Excel 파일을 저장

나는이 코드 조각 다운로드에 대한 HTML에서 파일을 만드는 페이지가 있습니다는 ASP

Response.ContentType = "application/vnd.ms-excel" 
Response.AddHeader "Content-Disposition", "attachment;filename=teste.xls" 

저장할 고전적인 ASP를 사용하는 방법이 있나요 파일을 클라이언트의 다운로드 대신 서버의 특정 폴더에 저장합니까?

답변

1

Scripting.FileSystemObject 개체를 사용하여 Classic ASP로 서버에 파일을 저장할 수 있습니다.

<% 
dim fs,f 
set fs=Server.CreateObject("Scripting.FileSystemObject") 
set f=fs.CreateTextFile("c:\test.txt",true) 
f.write("Hello World!") 
f.write("How are you today?") 
f.close 
set f=nothing 
set fs=nothing 
%> 
+0

가 IT가 어떻게의 경우 ASP Response.ContentType = "application/vnd.ms-엑셀" –

+0

로 생성 된 파일을 저장하지 않습니다 를 작동하지 않았다 : 여기에 텍스트 파일을 만들기위한 예입니다 당신은 순간에 엑셀 파일을 작성합니다 - 그냥 Response.Writing 쉼표 또는 탭 구분 값입니까? 생성 된 파일 이름을 .txt 대신 .xls 또는 .csv로 변경 했습니까? 원시 XLS 형식으로 파일을 저장할 수 없으므로 CSV 또는 탭으로 구분 된 파일이어야합니다. – johna