How to open a file with a link ?
I am using servlets to design an application.
The application supports uploading and downloading of .DOC and .RTF files.
My problem is that I am opening an uploaded file via a link.
OPen File
The above is also working fine and opens the file in the IE browser.
But my problem is that I want to open the file with MS-Word...as is done on many resume-building websites.
1) How am I supposed to do that ?
2) Can I specify ContentType="application/msword" in a link ?
Please Help !!
I did the foll. w.r.t a docbase.
A docbase stores documents and assigns an unique id to each one. The foll. is a code snippet that opens a document's contents in a browser.
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
Connection conn = null;
Statement stm;
ServletOutputStream sos = null;
ResultSet res;
// .... get id of document u want to open
query = "select id from .. where object_name = ' xx' .."
res= stm.executeQuery(query);
Blob blob = res.getBlob("_content"); // this will get content of document identified by id
int blobLen = (int)blob.length();
//the foll. is the part u need..
if (blobLen > 0) {
InputStream contents = blob.getBinaryStream();
response.setContentType("application/msword"); // MS Word
byte[] buf = new byte[blobLen];
int length = -1;
while ((length = contents.read(buf)) != -1){
sos = response.getOutputStream();
sos.write(buf,0,blobLen);
sos.flush();
System.out.println("Doc Received");
contents.close();
res.close();
conn.close();
}
Similar Messages
-
How to open a file with the extension x3f (sigma)
how to open a file with the extension x3f (sigma)?
RAW data from the following Sigma cameras is currently supported:
DP1
DP1s
DP2
SD9
SD10
SD14
If your camera is among these, then simply import the photo as usual. https://helpx.adobe.com/lightroom/help/importing-photos-lightroom-basic-workflow.html -
How do open PDF file with Adobe Reader?
I failed to open PDF file with Adobe Reader? Please show how to fix it.
Mac or Win? OS and Reader versions? Where is the file and how did you try to open it? What happened when you tried? Any error messages? Details, please.
-
How to open TXT file with excel 2007
With Excel 2003 if we right click the txt source file name, there will be an option to open the file Excel, but with Excel 2007, then we right click txt fiel name , there is no option of open the file with excel, is this mean that we have to copy the txt file to excel file to manipulate the source file? Any idea how to do this?
just find out that we can use the browser to find the excel and open the file, next time the excel option will be there.
-
How to open a file with the same name?
Hi, now I practicing making web pages where I put sample codes in one directory and I copy them to edit.
The probrem is, I couldn't open one file while I'm opening another file with the same name.
Is it possible to open a file with the same name in Dreamweaver?That could be a very error prone practice.
May I suggest you take advantage of DW "Snippets" feature instead.
Simply save any blocks of code you will reuse regularly as snippets,
and give each one a descriptive name you like.
Then you can simply place your cursor in code view where you wish the code,
and click insert on the selected item from the snippet panel. -
How to open a file with the assosiate program on suse????
i came to know that we can open a file with assosiated program on windows using "cmd /c start filename".
and i want the same functionality on suse linux.
in forums i found that "kfm filename" will do fine on linux.
i tried it on suse but no use at all.
i would appretiate the quick response and i would be very thankful
for the same.
Thanks alot in advance.take a look at java.awt.Desktop in the JDK SE 6 http://java.sun.com/javase/6/docs/api/java/awt/Desktop.html.
See these two methods:
- void edit(File file)
- void open(File file) -
How to open a file with a .bbb extension?
How do you open a a file with .bbb extension on a Mac?
ibopyoubopwebop wrote:
What happens if i decide to buy a non BB phone.
You can restore only to a BlackBerry device, and then once you copied what you wanted to the storage of your choice (computer or cloud). you can then copy it to whatever device you choose.
But to get the information from the backup file, you will need to use a BlackBerry 10 device
Using the Playbook and the Z10 and the Z30 and loving them
Martin -
How to open a file with approriate program
When I program a project I have a problem of opening a file. For example, If I open a word file I want to call Microsoft Word to open this file or if I open *.mp3 file I want to call Winnamp to open this file etc... I know that VC++ can do that by using ShellExecute() procedure but in Java I don't know how to do that. Can you show me how to do, please.
Thanks.
Duong Ngoc HieuYou may mostly have to do a JNI Call or Spawn a Process and do it. There is one another way of doing it. Use JNDI to search the Registry to find the Associated Program File, parse the commandline arguements and use it to spawn a Process. But I think you need some thirdparty components for Registry Access using JNDI. Try searching for JNDI Registry Access Components.
-
How to open a file with C# for wp8
I have a downloaded file (downloaded by my app) for instance a doc or a pdf.
How is possible to open it from my WP8 application using C#?
ThanksHi SeDevWP,
If you have installed a app that can open your file on your phone, then you can open it on your Windows Phone 8 application, for example, if you want to open a pdf file in your application and you have installed the Adobe Reader,
then you can use the following code to open the pdf file in C#:
private async void Button_Click(object sender, RoutedEventArgs rea)
StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
StorageFile pdffile = await local.GetFileAsync("file.pdf");
// Launch the pdf file.
Windows.System.Launcher.LaunchFileAsync(pdffile);
For more information, please try to refer to this document:
http://msdn.microsoft.com/library/windows/apps/jj206987(v=vs.105).aspx .
If you do not installed a app that can open your file on your phone, then maybe you need to check some third-party library to meet your requirement.
Best Regards,
Amy Peng
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
How to open pdf file with command?
I had trouble to open local pdf file with command by WebBrowser control in IE.(The Acrobat version is 6.0 or 7.0 in my PC)
The pdf command can be getted in this:
http://partners.adobe.com/public/developer/en/acrobat/PDFOpenParameters.pdf
I open a local pdf file in IE with pdf command "#Page=3&Pagemode=thumbs" firstly, and then I open the same pdf file without pdf command in other IE, but the second times the pdf file in WebBrowser still show page=3, other than page=1.
That is to say, the pdf command will affect others WebBrowser process after set .
<HTML>
<HEAD>
<title>WebBrowser</title>
</HEAD>
<body bgColor="#999999" MS_POSITIONING="GridLayout">
<script language="javascript">
function Input6()
var oWebBrowser = document.getElementById('oWebBrowser');
oWebBrowser.Navigate("D:\\Project\\Data\\PDF\07000001.pdf#Page=3&Pagemode=thumbs", null, null, null, null);
</script>
<form id="MethodTest" method="post" runat="server">
<OBJECT id="oWebBrowser" style="Z-INDEX: 108; LEFT: 10px; WIDTH: 880px; POSITION: absolute; TOP: 72px; HEIGHT: 600px"
classid="clsid:8856F961-340A-11D0-A96B-00C04FD705A2" VIEWASTEXT>
<PARAM NAME="_Version" VALUE="65536">
<PARAM NAME="_ExtentX" VALUE="18521">
<PARAM NAME="_ExtentY" VALUE="23230">
<PARAM NAME="_StockProps" VALUE="0">
</OBJECT>
<fieldset style="Z-INDEX: 103; LEFT: 250px; WIDTH: 275px; POSITION: absolute; TOP: 6px; HEIGHT: 56px; visibility: visible;">
<legend>Open Pdf</legend>
<input type="button" name="Open" value="Open" style="LEFT: 110px; WIDTH: 50px; POSITION: absolute; TOP:20px; HEIGHT:25px;" onClick="Input6()" />
</fieldset>
</form>
</body>
</HTML>
Please help me .Thanks.It is only appear in Acrobat 6.0 and 7.0.
-
How to open PageMaker files with InDesign CC ?
I need to open PageMaker 6.5 files with InDesig CC.
Please, give me a solution.From creative cloud desktop Install indesign cs6 (adobe creative cloud allow you to install both indesign cs6 and indesign cc on your computer)
See: Download InDesign CS6 from CC
http://forums.adobe.com/message/5485418#5485418 -
How to open alias files with applescript in Powerpoint?
I would like to do something like this:
set F to choose folder
tell application "Finder" to set P to (files of entire contents of F whose name extension is "ppt")
repeat with oneFile in P
tell application "Microsoft PowerPoint"
activate
open (oneFile as alias)
end tell
end tell
It works fine if all files are regular files.
But I want/need it to work also, if some of the files are aliases (icon has the little pointer in Finder).
Could some kind soul explain to me what I would have to do?
TIA.
Gabriel.Are you saying this doesn't work? Generally applications don't/shouldn't care about whether you pass them an actual file or an alias.
In either case, it's not hard to dereference the alias back to the original file:
set F to choose folder
tell application "Finder" to set P to (files of entire contents of F whose name extension is "ppt")
repeat with oneFile in P
if class of oneFile is alias file then
tell application "Finder" to set oneFile to (original item of oneFile)
end if
open oneFile
end repeat
Note that I've just specified 'open oneFile' rather than targetting PowerPoint directly - there's no need to target PowerPoint if it's the default application for .ppt files. However, there's no problem telling PowerPoint to open the file if you prefer. -
How to open a file with a specific program
I would like to do this in applescript instead of the terminal. I would like to pick the application and the file in the same command so to avoid opening a blank document.
open -a textedit /Users/mac/Desktop/GNPRC.docBoth of the previous solutions open the "GNPRC.doc" document. However, only the first one returns a result:
*tell application "TextEdit" to open POSIX file "/Users/mac/Desktop/GNPRC.doc"*
*get result* --> document "GNPRC.doc" of application "TextEdit"
*tell application "Finder" to open POSIX file "/Users/mac/Desktop/GNPRC.doc" using (path to application "TextEdit")*
*get result* --> AppleScript Error — The variable result is not defined.
Message was edited by: Pierre L. -
How to open a file with a .Ink ending?
I installed Dropbox (from Dropbox.com) and my files transfered from a windows computer were labeled with the .INK ending> was not able to open them on the mac... any ideas as to how or why?
ascala wrote:
I installed Dropbox (from Dropbox.com) and my files transfered from a windows computer were labeled with the .INK ending> was not able to open them on the mac... any ideas as to how or why?
Your subject line refers to a .lnk file extension and the body of your post refers to a .INK file extension. Which is it? If it is .lnk then it is a link to a file, not a file. In Windows a file name ending with .lnk is a shortcut link to the file. You likely copied over the shortcut rather than the file itself. Therefor you can't open it because it is not there on your Mac.
Message was edited by: BobTheFisherman -
How to open jsx file with 'do javascript'?
I am making a folder action to run an Illustrator script on a file. I am struggling with how to make Illustrator run a jsx file from within applescript. The default action seems to be to evaluate the string as javascript, not open the path as a jsx file. Thanks!
Im not having any issues are you passing a string or file as alias specifier? This worked with CS2 and basic test…
set JavaFile to choose file without invisibles
tell application "Adobe Illustrator"
set Doc_Ref to current document
tell Doc_Ref
do javascript JavaFile
end tell
end tell
the java snippet…
#target illustrator
alert('Hello');
And also this option with arguments…
set JavaFile to choose file without invisibles
tell application "Adobe Illustrator"
set Doc_Ref to current document
tell Doc_Ref
do javascript JavaFile with arguments ¬
{"Muppet", "Mark"} show debugger on runtime error
end tell
end tell
using snippet…
#target illustrator
alert('Hello ' + arguments[0]);
alert('Hello ' + arguments[1]);
Maybe you are looking for
-
Printing from my Mac to a Windows Vista printer
Hi, I'm trying to print from my mac to an Epson Stylus SX200 installed on my Vista PC. I have a wired network and printer sharing on etc but am getting in a right mess trying to get it all working. ] Can someone please go step by step on how to set t
-
How to send out email in HTML format instead of Plain text?
Can anyone help? Or any website with that information? I am trying to send out email using javamail. But i want it to be in HTML format so that i can set font size,coulor and so on. Thanks in advance if you have any clue or solution.
-
Digital Signatures for Changing the statuses in Issue Mgmt
Hi Has anyone put in place digital signatures for Issue Managemnt when we change the status values in an issue. We are looking at SAP Note 835584 - Digital signature for documents, but that is not applicable for us as we want to initiate the digital
-
HT1766 when i connect my iphone to pc the last stored ringtone get deleted from sound
when i connect my iphone to pc the last stored ringtone get deleted from sound why so ??
-
I am trying to post video to facebook but getting error message
I cant get my edited video on facebook keeps saying bad imagine? Can anyone give me answers why and help me out please.