Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copying an Excel file from ASP

Status
Not open for further replies.

mike4816

Programmer
Sep 5, 2002
2
US
I am new to ASP, JavaScript, and HTML, so all the help I can get would be greatly appreciated.

I am working on a project where I need to make a copy of an Excel file that a user selects from a drop down menu. The problem, one of many, I am having is in the Response.AddHeader line. If I do not put the ; before content-disposition, I get an error ' expecting ';'. If I do put it in, I get an error 'wrong number of arguments or invalid property assignment.

Here is the code I have so far:

<%@ language=&quot;javascript&quot; %>
<%
Response.Buffer = &quot;true&quot;;
Response.ContentType = &quot;application/vnd.ms-excel&quot;;
Response.AddHeader ;&quot;content-disposition&quot;, &quot;attachment; filename=filename1&quot;;
var filename1 = Request.QueryString(&quot;file&quot;);
var batchid = Request.QueryString(&quot;batid&quot;);
var batchiddesc = Request.QueryString(&quot;desc&quot;);
var filename2 = &quot;\\\\dwd-report2web\\d\\accountingdata\\journalentries\\store\\&quot; + filename1;
var filename3 = filename2;
var tmpfilename = &quot;\\\\dwd-report2web\\d\\accountingdata\\journalentries\\temp\\&quot; + &quot;tmp_&quot; + filename1;
%>
<!--#include file = &quot;../../../procedures/WebDevelopment/TransBatchProcess.js&quot; -->

<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;>
<html>
<head>
<title>Batch Input Process</title>

<!-- Body Headings-->

<center><font face=&quot;Times New Roman&quot; color=&quot;#000080&quot;>
<h1>FARS Accounting</h1>
<h2>Batch Input Process</h2>
</font></center>

<script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;>
<!--

function checkFile()
{
var fso = new ActiveXObject (&quot;Scripting.FileSystemObject&quot;);
{
fso.CopyFile ;&quot;<%=filename3%>&quot;, &quot;<%=tmpfilename%>&quot;;
fso=nothing;
Response.Flush;
Response.End;
}
}

Anyone have an idea how to get this to work and make a copy of the file?

TIA
Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top