|
 |
proasp_howto thread: Downloading Files using Netscape 6
Message #1 by "Jerome Henley" <Jerome.Henley@s...> on Wed, 27 Feb 2002 19:29:30
|
|
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C1BFDF.DF30E3E0
Content-Type: text/plain;
charset="iso-8859-1"
If you set the content header on the virtual directory in IIS, everything
underneath that directory should be treated as a download, even if it is 2
folders deep. You should not need to put this on each file.
David Debreceni
Senior Visual Basic/ASP Developer
xxx-xxx-xxxx x 1086
-----Original Message-----
From: Jerome Henley [mailto:Jerome.Henley@s...]
Sent: Wednesday, February 27, 2002 5:39 PM
To: Pro ASP HowTo
Subject: [proasp_howto] RE: Downloading Files using Netscape 6
Thanks David for the response.
I have a download directory located in my IIS virtual directory. I create
a sub-folder underneath that and then the file, which after the session
expires or after downloading it, I delete the file and sub-folder that was
created(security). So if I am to create an HTTP header on the download
folder I can do that, but I can not on the file because it is created on
the fly. Can I code in ASP the file that is to be created to have the
HTTP header="content-diposition" on the fly?
I am not using an anchor tag as a link, but an input type=button in an
opened window. The excel file is created with data from a db, then using
FSO and server.MapPath I place the file temporarily in my newly created
folder under the Download directory on the server.
The following code then gets the "save as" dialog box to pop up and the
user can download the xls document.
window.close();
top.frmMain.location = "szFilePath";
This window.top.location = the path of the new file created on my IIS
works to open a save as dialog box in Internet Explorer and Netscape 4.7,
but not in Netscape 6.
Does Netscape 6 not like window.top.frmMain.location?
Should I add Response.Addheader "content-disposition"?
thanks for your time and help,
Jerome
> I am not sure I understand completely what you want, but from what I
gather
> all you want is for the user to have the ability to click a link and
> download a file? I hope that is right. If so then why not make a
virtual
> directory under IIS for your downloadable files and then go to the
> properties and the HTTP header and add the custom header name -
> "content-disposition" and custom header value = "attachment". This
forces
> iis to treat a file as an attachment. I have never had problems with
this.
> I have had problems with response.addheader not working all the time
though.
> Hope that helps ya.
>
>
>
>
> David Debreceni
> Senior Visual Basic/ASP Developer
> xxx-xxx-xxxx x 1086
>
>
> -----Original Message-----
> From: Jerome Henley [mailto:Jerome.Henley@s...]
> Sent: Wednesday, February 27, 2002 2:30 PM
> To: Pro ASP HowTo
> Subject: [proasp_howto] Downloading Files using Netscape 6
>
>
> I'm trying to please every Browser with similar code, which is insane.
>
> However, until a better day comes that's exactly what we're doing. I
have
> some files that users to my site can download to their local machine in
an
> excel spreadsheet format for example. The code I use (or any variation
of
> it, it seems) works well in IE5 IE5.5 Netscape 4 and Netscape 4.7x. Here
> comes the clincher. Nothing I try works in Netscape 6.2 I have
upgraded
> my
> code for layer and DOM2 and getelementbyIDs etc. compliancy but the last
> piece, I can't find any documentation anywhere to help download an excel
> file (or any file) in Netscape 6.2
>
> Please help. All of these lines of code work in IE and NS4.x but none
work
> for NS6.x
>
>
> Set fs = CreateObject("Scripting.FileSystemObject")
> szFolderName = Server.MapPath("files/")
> ' make sure the folder exists
> If fs.FolderExists(szFolderName) = FALSE Then
> fs.CreateFolder(szFolderName)
> End If
> szFolderName = Server.MapPath("files/" & Session.SessionID)
> etc. then I move the created file onto my server in my directory
structure
> I created e.g.(/TestFile/Downloads/Files/223432633/)
> once the file exists on the server. The dialog window the user used to
> click the download button closes (window.close) and the following
> function is run.
> %>
>
> 'another page in project
> <SCRIPT LANGUAGE="JAVASCRIPT">
> szFilePath = "/TestFile/Downloads/Files/223432633/myfile.xls";
> window.location = szFilePath;
> //top.frmMain.location = szFilePath;
> //window.location.href = szFilePath;
> //top.frmMain.location = "szFilePath";
>
>
> (this snippet is to concise where I think the error resides)
>
> best regards,
> Jay
>
> $subst('Email.Unsub').
>
> ------_=_NextPart_001_01C1BFD5.6796F450
> Content-Type: text/html;
> charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
> <HTML>
> <HEAD>
> <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html;
> charset=3Diso-8859-1">
> <META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version
> 5.5.2653.12">
> <TITLE>RE: [proasp_howto] Downloading Files using Netscape 6</TITLE>
> </HEAD>
> <BODY>
>
> <P><FONT SIZE=3D2>I am not sure I understand completely what you want,
> but from what I gather all you want is for the user to have the ability
> to click a link and download a file? I hope that is right.
> If so then why not make a virtual directory under IIS for your
> downloadable files and then go to the properties and the HTTP header
> and add the custom header name - "content-disposition" and
> custom header value =3D "attachment". This forces iis
> to treat a file as an attachment. I have never had problems with
> this. I have had problems with response.addheader not working all
> the time though. Hope that helps ya.</FONT></P>
>
> <P><FONT SIZE=3D2> </FONT>
> <BR><FONT SIZE=3D2> </FONT>
> <BR><FONT SIZE=3D2> </FONT>
> <BR><FONT SIZE=3D2>David Debreceni</FONT>
> <BR><FONT SIZE=3D2>Senior Visual Basic/ASP Developer</FONT>
> <BR><FONT SIZE=3D2>xxx-xxx-xxxx x 1086</FONT>
> </P>
> <BR>
>
> <P><FONT SIZE=3D2>-----Original Message-----</FONT>
> <BR><FONT SIZE=3D2>From: Jerome Henley [<A
> HREF=3D"mailto:Jerome.Henley@s...">mailto:Jerome.Henley@s...
> om</A>]</FONT>
> <BR><FONT SIZE=3D2>Sent: Wednesday, February 27, 2002 2:30 PM</FONT>
> <BR><FONT SIZE=3D2>To: Pro ASP HowTo</FONT>
> <BR><FONT SIZE=3D2>Subject: [proasp_howto] Downloading Files using
> Netscape 6</FONT>
> </P>
> <BR>
>
> <P><FONT SIZE=3D2>I'm trying to please every Browser with similar code,
> which is insane.</FONT>
> </P>
>
> <P><FONT SIZE=3D2>However, until a better day comes that's exactly what
> we're doing. I have</FONT>
> <BR><FONT SIZE=3D2>some files that users to my site can download to
> their local machine in an</FONT>
> <BR><FONT SIZE=3D2>excel spreadsheet format for example. The code
> I use (or any variation of</FONT>
> <BR><FONT SIZE=3D2>it, it seems) works well in IE5 IE5.5 Netscape 4 and
> Netscape 4.7x. Here</FONT>
> <BR><FONT SIZE=3D2>comes the clincher. Nothing I try works in
> Netscape 6.2 I have upgraded </FONT>
> <BR><FONT SIZE=3D2>my</FONT>
> <BR><FONT SIZE=3D2>code for layer and DOM2 and getelementbyIDs etc.
> compliancy but the last</FONT>
> <BR><FONT SIZE=3D2>piece, I can't find any documentation anywhere to
> help download an excel</FONT>
> <BR><FONT SIZE=3D2>file (or any file) in Netscape 6.2</FONT>
> </P>
>
> <P><FONT SIZE=3D2>Please help. All of these lines of code work in IE
> and NS4.x but none work</FONT>
> <BR><FONT SIZE=3D2>for NS6.x</FONT>
> </P>
> <BR>
>
> <P><FONT SIZE=3D2>Set fs =3D
> CreateObject("Scripting.FileSystemObject")</FONT>
> <BR><FONT SIZE=3D2>szFolderName =3D
> Server.MapPath("files/")</FONT>
> <BR><FONT SIZE=3D2>' make sure the folder exists</FONT>
> <BR><FONT SIZE=3D2>If fs.FolderExists(szFolderName) =3D FALSE
> Then</FONT>
> <BR> <FONT
> SIZE=3D2>fs.CreateFolder(szFolderName)</FONT>
> <BR><FONT SIZE=3D2>End If</FONT>
> <BR> <FONT
> SIZE=3D2>szFolderName =3D Server.MapPath("files/" &
> Session.SessionID)</FONT>
> <BR><FONT SIZE=3D2>etc. then I move the created file onto my server in
> my directory structure </FONT>
> <BR><FONT SIZE=3D2>I created
> e.g.(/TestFile/Downloads/Files/223432633/)</FONT>
> <BR><FONT SIZE=3D2>once the file exists on the server. The dialog
> window the user used to </FONT>
> <BR><FONT SIZE=3D2>click the download button closes (window.close) and
> the following </FONT>
> <BR><FONT SIZE=3D2>function is run.</FONT>
> <BR><FONT SIZE=3D2>%></FONT>
> </P>
>
> <P><FONT SIZE=3D2>'another page in project</FONT>
> <BR><FONT SIZE=3D2><SCRIPT
> LANGUAGE=3D"JAVASCRIPT"></FONT>
> <BR> <FONT
> SIZE=3D2>szFilePath =3D
> "/TestFile/Downloads/Files/223432633/myfile.xls";</FONT>
> <BR> <FONT
> SIZE=3D2>window.location =3D szFilePath;</FONT>
> <BR> <FONT
> SIZE=3D2>//top.frmMain.location =3D szFilePath;</FONT>
> <BR> <FONT
> SIZE=3D2>//window.location.href =3D szFilePath;</FONT>
> <BR> <FONT
> SIZE=3D2>//top.frmMain.location =3D "szFilePath";</FONT>
> </P>
> <BR>
>
> <P><FONT SIZE=3D2>(this snippet is to concise where I think the error
> resides)</FONT>
> </P>
>
> <P><FONT SIZE=3D2>best regards,</FONT>
> <BR><FONT SIZE=3D2>Jay</FONT>
> </P>
>
> <P><FONT SIZE=3D2>---</FONT>
> <BR><FONT SIZE=3D2>Change your mail options at <A
> HREF=3D"http://p2p.wrox.com/manager.asp"
> TARGET=3D"_blank">http://p2p.wrox.com/manager.asp</A> or </FONT>
> <BR><FONT SIZE=3D2>
> $subst('Email.Unsub').</FONT>
> </P>
>
>
---<BR>
Change your mail options at http://p2p.wrox.com/manager.asp or <BR>
$subst('Email.Unsub').
</BODY>
> </HTML>
> ------_=_NextPart_001_01C1BFD5.6796F450--
|
|
 |