Results 1 to 2 of 2

Thread: Download

  1. #1
    Join Date
    Dec 1969

    Default Download

    Hi,<BR><BR>I am trying to create a script that when a user clicks on the link the file is not automatically opened, rather the save as / open box appears - giving the user the choice.<BR><BR>I have this working in JScript but only when the download file is in the same folder as the actual file itself. When I convert it to vbscript, i get an error message on the following line:<BR><BR>Response.addHeader("content-disposition", "attachment;filename=" & Request.Querystring("fn"))<BR><BR><BR>The error is as follows:<BR><BR>Microsoft VBScript compilation error &#039;800a0414&#039; <BR><BR>Cannot use parentheses when calling a Sub <BR><BR>/filelib/down.asp, line 28 <BR><BR>Response.addHeader("content-disposition", "attachment;filename=" & Request.Querystring("fn"))<BR>---------------------------------------------------------------------------------------------^<BR><BR>The whole script is as follows:<BR><BR>set objStream = Server.CreateObject("ADODB.Stream")<BR>objStream.T ype = 1<BR>objStream.Open()<BR>objStream.loadFromFile(Se rver.MapPath("lib" & Session("lib_id") & "cat" & Session("cat_id") & "\" & Request.Querystring("fn")))<BR><BR>Response.addHea der("content-disposition", "attachment;filename=" & Request.Querystring("fn"))<BR>Response.ContentType = "application/unknown"<BR>Response.BinaryWrite( <BR><BR>Thanks for any help in advance<BR><BR>Carl Cooke

  2. #2
    Join Date
    Dec 1969

    Default In VBScript you use brackets...

    ...only when you call a function and assign the value to a variable - not when you call a sub and not either if you call a function and don&#039;t use the returned value. So, in your case you need:<BR><BR>Response.addHeader "content-disposition", "attachment;filename=" & Request.QueryString("fn")<BR><BR>Where did you get the JScript from and why do you have to convert it to VBScript now?<BR><BR>Oliver.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts