File download dialog box events and work around
Hi all,
I have a amall problem.
when i set content type and header for downloading a file which is generated from the server i get a "file download dialog box" (open/save/cancel)
but the problem is i cannot capture the events i.e. if the client clicks 'cancel' since i cannot capture 'cancel' i cannot do some other modifications that need to be done when the file is not downloaded.
is there any way which i can track if the file is actully downloaded by the client or not??
Or is there any way i can just by pass this dialog box and get a "save as dialog box" which enables him to choose a location directly download to his hard drive.(In this case i ll get a javascript confirmation before actully creating the file)
i am using IE6SP1.
Thanks in advance for your support.
Just using JSP/HTML/Javascript code I don't think there is a way to do what you want. You might be able to do so using a Java Web Start application - like a download manager.
Similar Messages
-
File download dialog box problem!
Hi,
How do you force file download message box to use specified file name instead of JSP or servlet name.
I am using:
// code in attachment.jsp
<%
response.setContentType(mimeType.trim());
response.setHeader("Content-Disposition","attachment;filename=\""+attachmentViewBean.getAttachmentName()+ "\"");
%>
With the above code, browser first pop up file download dialog box informing
'You are downloading the file:[attachment.jsp] from host. Would u like to open the file or save?'
I want the file name that I had specified in setHeader("Content-disposition","attachment;filename=resume.doc") to appear(i.e. resume.doc) in above dialog box and not the servlet name.
Any suggestions/tips on this?
Your help would be greatly appreciated.
Thanks,
YogeshFor saving the document I have used -
res.setHeader("Content-disposition", "attachment; filename="+ FileName );
and it is working very fine, it saves the document with name specified in FileName
For opening the file in browser without any prompt-
res.setHeader("Content-disposition", "inline" );
For setting the content type -
try {
if(FileType.equalsIgnoreCase("pdf")) contentType = "application/pdf";
if(FileType.equalsIgnoreCase("doc")) contentType = "application/msword";
if(FileType.equalsIgnoreCase("rtf")) contentType = "application/msword";
if(FileType.equalsIgnoreCase("gif")) contentType = "image/gif";
if(FileType.equalsIgnoreCase("jpg")) contentType = "image/jpeg";
if(FileType.equalsIgnoreCase("html")) contentType = "text/html";
if(FileType.equalsIgnoreCase("htm")) contentType = "text/html";
if(contentType == null){
contentType="text/plain";
res.setContentType(contentType);
} catch (Exception e){
out.println("Exception while setting content type");
out.println("Exception : " + e);
return;
Hope this helps -
Change File Name In The "File Download" Dialog Box For Web Reports
Hi All ,
I followed the below note to change the "File Download" name.
How To Change The File Name In The "File Download" Dialog Box For Web Reports? Doc ID: Note:418366.1
However its not working. Has anyone tried this and works fine ?
Basically I wanted to change the name "rwservlet" when a report is run in an
excel format.
Rajesh Alex
Rajesh AlexHello,
Have you checked if a HTTP header "Content-disposition" is returned ?
You can use ieHTTPHEaders for IE
http://www.blunck.se/iehttpheaders/iehttpheaders.html
and
Live HTTP Headers for FireFox
https://addons.mozilla.org/en-US/firefox/addon/3829
Regards -
Hi,
I am creating a site using struts framework. In that one I code one "Download" hyperlink. Which should download Excel file to the client site.
For this I want the Windows File Download Dialog Box to pop up when the user presses the "Download"
hyperlink on the page. This is the dialog box which prompts the user to either open the file or save
the file.
However, instead of File download dialog box, IE opens the text document within itself.
From what I understand, if the Mime Type of the file I am trying to open is registered on the client
workstation, then this dialog box wont pop up as Windows would automatically get the registered Mime
Type from the registry and open the application. For this we need to add headers to http response (content-disposition). Where to add this header info. In JSP, Action classes?
Can somebody help.
ThanksI am facing a similar problem...however in my case my application is on Tomcat server and when the user clicks the link, he/she sees junk data (excel sheet data) in plain html which makes no sense (with lot of special chars, just like opening any binary file in notepad)
while if i run the application in WSAD then the links work fine....is there any difference in both the servers in the way they treat file download? -
Problem With File Download Dialog Box
Hi all,
I have jsp page that allows a user to export oracle data to excel.
I have these code in my page:
<%@ page contentType="application/vnd.ms-excel" %>
response.setContentType ("application/vnd.ms-excel");
response.setHeader ("Content Disposition",
"filename=\"historicalrate.xls\"");
I run the page and it popups a file download dialog box with Open and Save buttons.
When I click the Save button a Save As window opens with a hr.xsl file name and Microsoft Excel Workbook(*.xls) as save type. It is what I want.
The problem I have is when I click the Open button on the file download dialog box it displays data in excel format on a browser well. Then I click File > save as on browser's tool bar the Save As window pop up with no file name and a default Text(tab delimited)(*.txt).
I need the file name and Microsoft Excel Workbook(*.xls) as default save type.
Any help would be greatly appreciated.
Please help
ThanksI have the same problem with hui_ling.
When user click on "Open", Excel start and open excel file correctly but the file name on excel title bar. 'Cause the file name is in Japanese characters. Any one can help me?
Message was edited by:
TNTVN -
Urgent!!how to open the file download dialog box????
Hi all,
i'm using the browse button for the user to select the file
and a submit button, which when cliked should open the file
download dialog box asking for open or save.
i searched for so many forums and websites and didn't get the
solution yet.
i'm using jsp.
anyone have the jsp code for the same????
will b more helpful if u send it to me.
thanx in advance.Hi
Use the Filedialog class.
Let your button call a method wich contains the following Java code:
FileDialog filedialog =
new FileDialog( Frame1.this, "Open a File", FileDialog.LOAD );
//witch calls this constructor: public FileDialog(Frame parent, String title, int mode)
//use Filedialog.SAVE to save a file.
filedialog.show();
String filename = filedialog.getFile();//to display the name of the file
String directoryname = filedialog.getDirectory();// to display the directory name -
File download dialog box -running report
I am calling one report from my Oracle 9i Developer Suite Application. When i call one report using 'delimited' format, the run runs okay opening in a new Internet Explorer(IE) instance. But, when i call another report, the File download dialog box -running report opens which asks whether u want to open the file or save it in your computer. I hope, my doubt is clear.Please help me in this as it is very urgent.
Regards.This is a duplicate post. Please followup on your previous posting.
What is the URL you specify? -
How to get file download dialog box in IE 6.0 for .CSV files?
In our Java application, when we download .csv file (by clicking a tool bar button or menu item) in IE 5.5, it brings up the download dialog box and when we click the open button it opens the file in a seperate browser window but after migrating to IE 6.0 it doesn't bring the download dialog box and we are not able to open the excle sheet in a new browser window.
We tried downloading .csv file in IE 6.0 by changing its extension(such as .cs1 and .xls) even then it did not work.We also tried associating CSV type of extension with "Microsoft Excel Comma Separated Values File" in the Windows folder options (Windows Explorer->tools->folder options->file types(tab)), which did not work.
Please respond if you have come across this kind of issue and solution for the same.
Thanks in AdvanceThis has nothing to do with Java. It's Microsoft
setting for known file type. IE is responding to the
setting which will automatically download known file
type (MIME type).
To show the "Save As" file dialog, you have to do the
following (for each file type)
1. open Window Explorer
2. click on Tool-->"Folder Option"
3. click on the "File Type" tab
4. select the extension and then click on the
"Advance" button
5. Check the "Confirm open after download" checkbox
6. Click OK
IE should now display the "Save As" file dialog for
that extension. Remeber, you have to to this for all
extension you want to see a "file dialog" pop up.Unfortunately this is not the only cause. Even with this box checked, downloading java source files from the pages of The Java Tutorial causes them to open in the most recent IE - I (and others also) don't get the save/open dialog box. Java source files downloaded from (some) other websites result in the save/open dialog box. I believe that one of the security changes that MS made in IE's handling of files is the cause. The setting of content-disposition by the server appears to be the key, according to MSDN information. -
Orarrp, IE file download dialog screen always asks before opening
orarrp 1.3.4 working, but under IE5.5, the File Download dialog
screen is activated when the web.show_document(<url>,'_BLANK')
call is made, where the extension of the file is ".rrpa".
The checkbox which reads "Always ask before opening this type of
file" is checked and disabled. This means that user intervention
is always required.
When I open the .rrpa file directly in IE (the file is available
on a locally attached drive -- that is, not as a URL at this
point), IE opens and immediately prints the .rrpa file.
Obviously the restrictions here are based on internet security
settings, however, I've been unable to overcome this problem.
There do not seem to be options in IE, nor in the
characteristics of the file types themselves.
Question: How do I set my environment to enable the "Always
ask ...." check box, so it can be uncheck?I have no solution to my problem -- just more research results.
From MS's support database, article Q232077, IE has a
predefined, hard-coded list of file extensions that it
inherently distrusts, which results in the "Always ask before
opening" option to be checked and grayed out. The hard-coded
list does NOT include orarrp extensions (such as .rrpa), but
instead, extensions like .exe, .com, .bat, .cmd.
Nonetheless, ".rrpa" is still seems to be treated as a
permanently distrusted application -- I do not know why.
To quote the aforementioned article: "[T]he File Download dialog
box is not preventable in any way. This includes the use of HTML
tags, script in the page, hosting the WebBrowser control, and
changing security zone options."
The article does go on to describe IE/Windows only solutions:
<IFRAME> tag pointing to a shared Windows directory using MS's
UNC; and ActiveX/cab construction and deployment. Clearly,
neither is a solution.
I can't quite conclude that there is no solution under IE, but
its close. -
Wpg_docload not producing a file save dialog box
Hi Everyone,
I have a BLOB column in a database table and I want to show a link on a web page so when user click on it, it pops up a file download dialog box giving the user option to either open or "save as".
I am using wpg_docload.download file but it seems to be load the blob data into the browser (inline)
Here is the code:
-- get image size
intimgsize := dbms_lob.getlength(page_b_contents);
-- print the header
owa_util.mime_header('Content-Type:application/vnd.ms-word;charset=utf-8', false);
htp.p('Content-length: ' || intimgsize);
htp.p('Content-Disposition:attachment filename="test.doc"');
owa_util.http_header_close;
-- download BLOB
wpg_docload.download_file(page_b_contents);
Any thoughts what might be wrong?
ThanksHow must wpg_docload.download_file hack across the network, and into the client o/s process executable running the browser, and then force that browser process to pop up a dialog box to save contents as a file?
Do you understand the concept behind Mime types? The browser has specific actions (some configurable) for specific Mime types. PL/SQL can specify the Mime type. And provide a well formatted Mime header. It cannot however force the browser to act in a specific way when it receives that Mime stream from PL/SQL.
See Office 2007 File Format MIME Types for HTTP Content Streaming - VSOfficeDeveloper: Known Problems, Bugs, and Fixes - Si… for basic header details. -
Seeing multiple file download dialogs trying to download one file.
I'm seeing some strange behavior from an application that uses the Safari Webkit to download a file from within the app. When I click the 'download' button I get cascading file download dialog boxes. Sometimes it is only two and sometimes it is 15+. Has anyone ever heard of this before????? Could it potentially be related to Java script or the version of Java?
Thanks!Yes I've been in contact with the developer and they aren't sure what the issue could be as it seems to be happening for only a few users. From what they can tell it is only on Leopard. They use an SDK that calls into the Safari webkit, so they thought it might have something to do with my Safari preferences.
-
How can I forward next page, and then pop-up a download dialog box.
My require is that pop-up a download dialog box after forwarding next page.
I have read the coding in the processFormRequest of current page like below,
but I find out that it only can pop-up a download dialog box,
however, it can't forward the next page.
pageContext.setForwardURL("OA.jsp?page=/oracle/apps/xxfm/fm002/webui/TEST001PG",
null,
OAWebBeanConstants.KEEP_NO_DISPLAY_MENU_CONTEXT,
null,
null,
true,
OAWebBeanConstants.ADD_BREAD_CRUMB_NO,
OAException.INFORMATION);
//set default file name: [YYYYMMDDhhmm_IN.EXCEL,FILE_NAME.csv]
StringBuffer strFileName
= new StringBuffer().append((pageContext.getCurrentDBDate().toString().substring(0, 16))
.replaceAll("-","").replaceAll(" ","").replaceAll(":",""))
.append("_IN.").append(strExcelFileName).append(".csv");
//give csv file content
BlobDomain csvFileBlob = (BlobDomain)am.invokeMethod("createCsvFile");
//setenv
HttpServletResponse response
= (HttpServletResponse)pageContext.getRenderingContext().getServletResponse();
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment; filename="+strFileName.toString());
System.out.println("fileName : "+strFileName.toString());
//download
InputStream fileIn = csvFileBlob.getBinaryStream();
long fileLen = csvFileBlob.getBufferSize();
int readBytes = 0;
int totalRead = 0;
byte blockgbyte[] = new byte[65000];
response.setContentType("application/x-msdownload");
response.setContentLength((int)fileLen);
while((long)totalRead < fileLen)
readBytes = fileIn.read(blockgbyte, 0, 65000);
totalRead += readBytes;
response.getOutputStream().write(blockgbyte, 0, readBytes);
fileIn.close();
response.getOutputStream().flush();
I don't know what's matter in the app, can you tell me how to deal with it.
Thanks in advance.Hi there,
I have a similar requirement. User will download search results in a CSV file after which I want either the page to be refreshed or to be able to goto a Confirmation page or navigate to another page.
I tried using setForwardURL / forwardImmediately / redirectImmediately methods as well as redirectToDialogPage. Since we use pageContext.setDocumentRendered(false); and response.getOutputStream().flush(); methods, the HttpResponse is already committed.
Hence, the page does not redirect to another page as Request is processed and Response is complete. In case of methods like setForwardURL A JSP forward redirects the same request object to the target URL.
Can anyone help here to achieve the expected requirement?
Thanks. -
Modifying the name of the file in the download dialog box
Hi all!
I've a javascript page that make a pdf document in the fly and download that document. Everything is fine, but I'd like to know how can I modifying the file name in the download dialog box, i.e., when the page display:
"You are downloading the file:
xpto.jsp from ..."
I want to substitute the "xpto.jsp" by "file.pdf".
I've already theses lines:
response.setContentType("Application/pdf");
response.setHeader("Content-Disposition", "attachment; filename="+ nameFile+";");
response.setHeader("Content-Length", ""+stp.length);
but the problem persist.
Note that in the second window, the Save As window, everything is fine, the nameFile appears in the file name box. The problem it's only in the first window, the File Download window.
Thanks for any help,
A. SantosI've discover something. When the File Download window it's displayed with the following text:
"You are downloading the file:
xpto.jsp from localhost
Would you like to open the file or save it in your computer?
button OPEN button SAVE button CANCEL button MORE INFO"
if I press the OPEN button then another File Download window opens with the rigth text:
"You are downloading the file:
file.pdf from..."!!!
i.e, the text desired!
So the first window is unnecessary and undesired!
How can I remove this first File Download window??
Please help!
A. Santos -
Word and Excel file and folder icons missing in File Open dialog box
Running office 365 on Windows 7 Pro: In Word and Excel, when opening and browsing for files in the file Open dialog box, all file and folder icons are missing. This problem does not occur within Windows Explorer.
Can you open Word/Excel files normally?
Go to File>Advanced>Disable hardware graphics acceleration
Start Office in safe mode to troubleshoot the issue:
http://office.microsoft.com/en-001/support/why-cant-i-start-my-office-2013-application-HA104011864.aspx
If the issue persists, do a repair for your Office suites in Control panel>Program and features>Office>Change>Repair
Tylor Wang
TechNet Community Support -
Oracle BPM 10.3 File Save Dialog Box
Hi,
I am using Oracle BPM 10.3. Can anybody tell me that how to get a File Save Dialog box in the method. On the method call i want to call Save Dialog box which will save the file on the local computer.
Thanks
Edited by: user9293762 on Sep 2, 2010 9:35 AMThe compilation within Studio works with a bit smaller (like 35MBytes) project, thus I think the problem is some sort of memory handling.
The problem comes up while it is trying to compie/load 'external resources': it still works with 512M or even 256M of heap before this operation.
Some weird thing is that I cannot set Xmx >640M, nor launcher.XXMaxPermSize > 1024M (winXP SP2, 2G RAM). While I'm sure that nothing is hacked around the memory allowance of Windows (i.e. how much memory does it allow for particular executables), I think this operation should be tested to work even on 256M heap...
On the other hand, the ANT compilation works well.
Well, almost well.
I have had some errors in my project, which ALBPM6.0 said to be OK, like defining a String array attribute 'not null' and setting no default value; or defining some object to be abstract and instantiating it.
However these errors are not always reported, e.g. during catalog compilation: XY must be explicitly instantiated before being used since it does not have a default initialization... thus made it static (however, it has been used as static all the time).
I had to hack CatalogPublisher a bit so that I can read them on stdout, and correct those syntax errors.
For this possibility, iterate over the non-empty foCheckerListener.getPresentationErr() in CatalogPublisher after checkXO().
Maybe you are looking for
-
Problem Opening document in New Window
Hai all, in my JSP page i have a link. the link path i am getting from database which is actually a word document present in a local drive. to open the file in a new window i have written the code like this <a href="<%=docPath %>" target="_blank">Ope
-
Displaying HTML page within Flash
Hello! We need to display an HTML page within a Flash executable file. We request the members of this forum to kindly guide us on how to go about it. Looking forward to your reply. Thanks and Regards, Hayagriva Software
-
IOS5 taking along time to load - what now? it seems stuck.
I have loaded the itunes software, the IOS5 software, etc - now trying to restore the software for the iphone and it's stalled. It seems stuck at 15% - now what?
-
I have xp system, and the icon of microsoft security essentials disappear and i can't scan or update my computer
-
GmaiI crashes the iPad; everything locks up and I can't get any response.
I foolishly opened many Gmail messages on my iPad while looking for an old message. Now I can only open one or two messages before the screen locks and there is no response to any command. I have to go back Home and open mail again. If I Delete my