Eddie D.
Eddie D.

Reputation: 145

Saving a generated EXCEL file from HTML into the server with ASP

I have a page that makes a file from a HTML for download with this piece of code:

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

Is there a way using classic ASP to save the file into a specific folder in the server instead making the client download it?

Upvotes: 0

Views: 1348

Answers (1)

johna
johna

Reputation: 10752

You can save a file on the server in Classic ASP using the Scripting.FileSystemObject object. Here's an example for making a text file:

<%
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
%>

Upvotes: 1

Related Questions