| | |
how to download a file without opening file download dialog box
![]() |
<a onclick=" window.open('C:/Documents and Settings/palanikumar.r/Desktop/Doc.bat','remarks','height=600,width=915,left=50,top=50')" ><input type="button" value="start" onClick="startclock('')"></a>
see, in the above coding i am using button to open a document file.
im opening it through the batch file..
the batch file contains
@echo off
c:
cd\
cd jdk1.5.0_05\bin
javac Doc.java
java Doc
Doc.java is a java program through this java program i am opening a word application
import java.io.*;
public class Doc
{
public static void main(String[] str)throws IOException
{
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + "C:\\Program Files\\Microsoft Office\\OFFICE11\\WINWORD.exe");
}
}
when i clicking the button in the html file the batch file runs first and it calls the java program and then the word application open.
And my problem is when i am clicking the button the batch program is called at that time the file download dialog box is opening.
i dont want to open the dialogue box.
if possible pls help.
see, in the above coding i am using button to open a document file.
im opening it through the batch file..
the batch file contains
@echo off
c:
cd\
cd jdk1.5.0_05\bin
javac Doc.java
java Doc
Doc.java is a java program through this java program i am opening a word application
import java.io.*;
public class Doc
{
public static void main(String[] str)throws IOException
{
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + "C:\\Program Files\\Microsoft Office\\OFFICE11\\WINWORD.exe");
}
}
when i clicking the button in the html file the batch file runs first and it calls the java program and then the word application open.
And my problem is when i am clicking the button the batch program is called at that time the file download dialog box is opening.
i dont want to open the dialogue box.
if possible pls help.
You are getting a download box, because the browser (I assume your on Windoof) does not know what to do with files that have an extension of ".bat", so it is asking you what it should do with it. You need to add a mime type for ".bat".
This entire action, is, however, wrong on so many levels (technical, practical, and security levels) that I cannot even begin to list them.
Edit: Or a mime type exists, but its action is save/download, in which case you simply need to cahgne the mime type. But see my above comment.
And, on a side note, why did you open a new thread for this, rather than simply replying to my post in your other thread?
This entire action, is, however, wrong on so many levels (technical, practical, and security levels) that I cannot even begin to list them.
Edit: Or a mime type exists, but its action is save/download, in which case you simply need to cahgne the mime type. But see my above comment.
And, on a side note, why did you open a new thread for this, rather than simply replying to my post in your other thread?
Last edited by masijade; Nov 21st, 2007 at 6:24 am.
Java Programmer and Sun Systems Administrator
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
![]() |
Similar Threads
- File Download Dialog Box(ASP) (ASP)
- How a doc file can be open inside browser without prompting the download dialog box (ASP.NET)
- how to open a file without clicking run button in the file download dialog box (Java)
- File Download Dialog Box(ASP) (ASP)
- file open dialog box control in asp.net (ASP.NET)
- File Download dialog Box Not appearing (Windows NT / 2000 / XP)
- IE; Getting file download box when attempting to access a particular web page (Web Browsers)
- File Download - Security Warning - Win XP (ASP.NET)
Other Threads in the Java Forum
- Previous Thread: how to open a file without clicking run button in the file download dialog box
- Next Thread: need help with java program.
| Thread Tools | Search this Thread |
6 @param actuate android api applet application arc array arrays automation balls binary bluetooth bold business byte c++ chat class client code codesnippet collections compare component coordinates database defaultmethod detection doctype dragging ebook eclipse educational error file fractal froglogic game givemetehcodez graphics gui guitesting helpwithhomework hql html ide ideas image ingres input integer internet intersect invokingapacheantprogrammatically j2me java javaexcel javaprojects jni jpanel jtextarea julia linux list map method methods mobile mysql netbeans newbie nextline parameter php pong problem program programming project recursion recursive scanner sell server set sms sort sql string sun swing swt terminal threads tree web websites windows






