As I
updated in my previous mail that the solution suugested by Gunter worked fine to
specify the file name.
response.setHeader("Content-Disposition", "attachment;
filename=myfile.txt;");
I ran
into another problem after modifying the header. I am not sure if that is a
problem with browser, or I need to set another attribute in the header.
Following is the error.
1. When I click the Download button on the html page, it
displays the "File Download" dialog box with the filename specified in the
"content-Disposition" header.
2. However when I click the "Open" button on the file
download box, I get another dialog box, "Windows cannot open this file
........". Then I select "Select the program from a list" option and click "Ok"
and then I select "notepad" from the "Open With" dialog
box.
3. After this it opens the notepad application, and
displays another dialog box with following question"
"Cannot find the D:\Data\...............\Temporary Internet
Files\Content.IE5\8AFR0TYJ\myfile[1].txt. Do you want to create a new
file?"
I click the "yes" button and but still it does not download
the file correctly. Also I am not
sure why the filename gets manipulated with "[1]"
text.
Is there any setting in Ineternet Explorer to rectify this
problem or there is something wrong with my program?
THE SAME THING WORKS WELL IN MOZILLA, i.e., FILE GETS
DOWNLOAD PROPERLY WITH DESIRED FILE NAME.
Could someone please suggest on as to what could be wrong
with my program.
Thank you for your help.
-----Original Message-----
From: Gunter D'Hondt [mailto:[EMAIL PROTECTED]
Sent: Friday, October 22, 2004 2:50 PM
To: [EMAIL PROTECTED]
Subject: Re: specifying filename in map:read
From: Gunter D'Hondt [mailto:[EMAIL PROTECTED]
Sent: Friday, October 22, 2004 2:50 PM
To: [EMAIL PROTECTED]
Subject: Re: specifying filename in map:read
you should set the http header content-disposition; I don't know exactly if that can be easily set in the sitemap but if that doesn't work you can easily define an action that does it:
response.setHeader("Content-Disposition", "attachment; filename=yourfile.extension;");
sometimes it also necessary to place a space between "content-" and "disposition"Gunter
"Jain, Neeraj" <[EMAIL PROTECTED]> 22-10-2004 06:33
Please respond to
[EMAIL PROTECTED]
To"'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> cc Subjectspecifying filename in map:read
Hi,
I am trying to download a file from server and I have following entry in the sitemap for the same.
<map:match pattern="myURI*">
<map:act type="myURI-action">
<map:read src="" mime-type="application/dbexport"/>
<map:redirect-to uri="{result}"/>
</map:act>
<map:redirect-to uri="cocoon:/main.html?title=error+in+myURI-action"/>
</map:match>
Now, I am able to get the file correctly but the "File Name" field in the file download dialog is a random text. Is there is way to specify this field from my myURI-action class?
Also the "Type" field is blank in the File Download dialog box. Can someone please tell me how can I specify the filename here.
Thanks.
