Download file on button action

Hi all,
I want to download a word document template when i click a download button but not using file download element.can anyone suggest me how to do this?
Regards,
Anusha

You can use the code that gets file from server.. Without using File download UI element
IWDResource resource;
    String name = <file name>;
    String path = <path> + name;
     InputStream stream;
     try {
          stream = new FileInputStream(path);
          resource = WDResourceFactory.createResource( stream, name,
                              WDWebResourceType.UNKNOWN, true);
          stream.close();
          wdComponentAPI.getWindowManager()
                         .createNonModalExternalWindow( resource.getUrl( 0), name).show();
     } catch (FileNotFoundException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
     } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
vinod

Similar Messages

  • ADOBE DPS - MAGAZINE to TABLET in INDESIGN.....Need to brush up my tablet design in DPS (did it a few yearscback), can anyone recommend on the Adobe site tutorials that I can download, with artworks /buttons / actions and put it together?

    ....Need to brush up my tablet design in DPS (did it a few years back), can anyone recommend on the Adobe site tutorials that I can download, with artworks /buttons / actions and put it together?

    See this forum post here from Bob. Best place to learn DPS is on Adobe TV http://tv.adobe.com/product/digital-publishing-suite/
    If you are specifically looking to learn how to create interactive overlays, go here http://helpx.adobe.com/digital-publishing-suite/help/overview-interactive-overlays.html Watch the videos on "Folio Overlays panel, Part I & Part II"

  • Download file from button

    Hi Guys,
    I followed thread 214709 (download blob from table) and had similar code in my Portal app. I have a stored procedure with almost identical code. My page has a drop down list which shows the last 12 sales files a customer can download. Behind it I have a Download Button.
    The procedure gets executed but the download window does not show up. If I put the call in a before header it actually works so nothing is wrong with the code. Where do I have to put the call and do I have create an additional branch. After download theu user should stay on that page. I actually have 3 sections with 3 buttons to download or request a file to be emailed.
    So my last question is what is best practice in this situation.

    the thread you followed...
    Downloading BLOB from a table.
    ...showed you how to make a procedure similar to our P procedure that's used to fetch blobs out of a document table. once your file download procedure works, you can call it from the web in one of three main ways:
    1) using an image tag as shown in File Upload ( again! )
    2) using an anchor tag as shown at the top of File download-upload
    3) directly calling it from the URL. this is effectively the same thing as clicking on a link from an anchor tag in number 2, above.
    it sounds as if your download procedure's working because you said it works if you call it before_header. i'm gathering from your post that you are currently trying to call your download procedure in some kind of after submit process. you're finding that your procedure's executing, but you don't see your file. i just set up a test case for this and found that if my page didn't have a branch on it, my after_submit process did render my image correctly. it doesn't sound as if this is what you're shooting for, though. it sounds as if you just want a select list that allows users to select a particular doc. after selecting a doc and clicking a button on your page, the user is allowed to download the doc while still being left on your original page. if so, how about creating a button that calls a javascript procedure that checks the value of your select list and returns a rendering of that image? if that's what you're after, you could do it by adding javascript like...
    <script language="JavaScript" type="text/javascript">
    function viewSelImage (theItem)
    var selVal = document.getElementById(theItem).value;
    var url;
    url = 'getmyfile?p_id=' + selVal;
    location.href=url;
    </script>
    ...which, of course, assumes your document download procedure is publicly executable and named "getmydoc". it also assumes that getmydoc accepts p_id which corresponds to your document table. then, assuming your select list item is called P1_MY_IMAGE_IDS, you could add a button to your page that has a URL target of...
    javascript:viewSelImage('P1_MY_IMAGE_IDS');
    ...and that would popup a call to your document download procedure while leaving the user on the same page... which i believe is what you're after.
    hope this helps,
    raj

  • InDesign Button Action for PDF – Open File (in new window)

    I am using the 'Open File' action on buttons in a document i am making which will eventually be a PDF, but am wanting to specify the button action to open the file (another PDF) in a new window.
    I have found that I can achieve this and add button actions with this specific behavior in Acrobat, but it seems to be missing in indesign's abilities as far as I can see. Is there a way to do this in indesign so that i do not have to tinker in acrobat after I have made my PDF. As if I have changes to the PDF, all buttons then have to be totally re-done each time, and i will have possibly 900 buttons!!
    Thanks.
    (Using indesign CS4)

    Jeff,
    You are correct. I want to have a DVD with multiple PDFs. The main one almost acting as a table of contents for the rest.
    Problem = the 'main one' is 62 pages long, many hundred buttons and every page has at least a few of these links needed.
    Which means, if you are correct (and I believe you are, hope you aren't) that I need to custom code these buttons in Acrobat.
    The method is easy, but x300 = painful. And then the kicker... Boss says, 'Change slide 30' ... which means: Back to InDesign, Export to PDF, Recode ALL BUTTONS.
    *Note, there are some 'interactive' buttons with roll over states. So I don't think replacing the pages would work.

  • Help in button action to open a file that is attached to main pdf doc

    Hello,
    I have created a button and used an icon saying "click here...." the action I want to attach to it is to have on mouse down for it to open the file which is attached to the document.
    Is this possible?  If so how do I direct the acton of "open file" to be the one attached in document?  can't figure out path...
    there was a suggestion of how to make a javascript for the button action to open the attachment panel...
    this is what was written... and then below that is my question on what was written...
    thomp wrote:Try thisif(app.viewerVersion < 8)
    app.execMenuItem(....);
    else
    app.execMenuItem(....);
    what would go in the '(...)' above?
    I am very poor at javascript, but I am guessing that there is something I would need to fill in there? Am I correct?
    thank you...
    I, too, am trying to get my button action to open the attached document in my pdf form - NOT the navigation panel... I already have it doing that...
    thanks again for any feedback!

    Erin,
    After you set your link... go back into the edit mode, click on your link and go to Actions Tab, click on the "go to page view in another document' under the actions part of that tab (bottom portion of page), then click on Edit... it will open a 'Target Document' window and in the top portion click on 'open in...' drop down box and select 'new window'.... close out and SAVE!
    Hope that helps!

  • When I click on download button, it goes right to the "thanks for downloading" splash page,and yet nothing has downloaded -- no download file box comes up, nothing. goes

    When I click on download button, it goes right to the "thanks for downloading" splash page,and yet nothing has downloaded -- no download file box comes up, nothing.
    I stupidly uninstalled the version of iTunes I had working on my notebook when the update kept failing and am now unable to get anything happening at all.

    I had probs with 7.2. Reloaded 7.1 works fine. I think 7.2 needs some more work before it will work for me.

  • Download file link in adf command link action

    Hi,
    i want to make a link on my web page , when my users click that link they can download a file
    how can i do that
    i use the thread
    Re: Download File Link in jspx
    but not works for me
    could any one help me to sort out the issue
    Thanks in advance

    Hi,
    i want to make a link on my web page , when my users click that link they can download a file
    how can i do that
    i use the thread
    Re: Download File Link in jspx
    but not works for me
    could any one help me to sort out the issue
    Thanks in advance

  • Unable to download file from FileDownload UI Element - Java Web Dynpro

    Hello Experts,
    I am facing a strange issue.Scenario is:
    I created an java web Dynpro application (Please note that it is just a standalone WD app, not integrated in portal) with just one FileUpload UI Element ,one FileDownload UI element and one button (for triggering an action).
    I browse a file (e.g. text,pdf,doc etc.) and click on button. It uploads the file and when I click on download, there are two cases:
         1) Simply click on download does not downloads the file and shows error: "Unable to download <file name> from <server name>.  Unable to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later." Though it is opening the file,showing the content.
         2) I opened that portal URL in a new tab in same session and logged in with a portal user. Now if I click on download link of same WD app opened in different tab of same session, it downloads the file without any error.
    I am using portal 7.0
    Can somebody point what's going wrong with case 1?
    Helpful pointers will be appreciated.
    Thanks,
    Kirtiman

    Hi Sid,
    I did not gave any authentication of WD app as it is anonymous app. There is no parameter set in application properties.
    As I run the app, it is showing the initial screen with UI elemtns and till upload works fine,.It has to be an anonymous app, so cannot ask for credential from user.
    Thanks
    Kirtiman

  • Download file

    I have a small servlet that allows the user to download a file.
    My problem is that I don't know how to check whether or not they accepted to download the file or the hit the 'cancel' button.
    here is a small chunk of code:
    res.setContentType("text/plain");          
    res.setContentLength(file.length);
    res.setHeader("Content-Disposition", "attachment;filename=" + ename);
    res.getOutputStream().write(file);
    //perform another action based on user actionI need to know after "res.getOutputStream().write(file);" whether or not the user accepted the download. Any help is greatly appreciated.

    Basically once that file is downloaded I have to change its status in the db to 'taken'. After 24 hours it changes back to 'available'. I was thinking of just adding a confirmation where the user just clicks on a button confirming that they received the file and then the status gets changed.
    Any way for me to do a page reDirect after the download?
    Thanks in advance.

  • Download file by a link.

    I have an image (download) in a jspx page, on which user could right click and be able to save the file. But when I right click on the image and say save as, i am unble to save the file, but able to save the jspx page itself. How can it be resolved?
    <af:outputText value="Download" inlineStyle="font-family:verdana;color:#990033"/>
    <af:commandLink action="../resource/wave/abc.wav">
         <af:objectImage source="../resource/image/download.gif"/>                                          
    </af:commandLink>Thanks in advance
    Uday

    Nice topic! =)
    Can someone post it here a exemple that is possible to download files from a jspx page!
    Because mine is not working well! I got the error JBO-35007, when I tried to download the 3rd file!
    I have a table with a botton called Download! When I'm donwloading the 3rd file I get the error JBO-35007 ! The same error of the famous back-button!
    The solution is the same ?
    Or I can put a new column using a command-link for each row. But what will be the code, so each command-link donwload the file in the corresponding row???
    Message was edited by:
    J-_-P                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Downloading file

    Hi all,
    i have a jsp page with download button on it...when i click on download button, it starts downloading file.
    now the problem is if the IE setting has high security....
    it will prompt to download file....on clicking allow downloading file...the whole page gets refreshed and the data in my jsp page to download is loss.....
    how to restore that file for downloading...???
    Thanks

    i am using ajax for this...
    i have index.jsp , filecreator.jsp and pdf download.jsp pages
    pdfdownload.jsp
    <%@page     import="java.io.*"%><%
    String path = request.getParameter("sPath");
    String Filename = request.getParameter("sTitle");
    //System.out.println("Path = " + path);
    //System.out.println("File = " + Filename);
    String PDFfile = Filename;
    response.setHeader("Cache-Control", "no-cache");
    response.setDateHeader("Expires", 0);
    response.setHeader("Pragma", "No-cache");
    try {
    response.setContentType("application/pdf");
    String disHeader = "Attachment;Filename="+PDFfile;
    response.setHeader("Content-Disposition", disHeader);
    File file = new File(path);
    FileInputStream fileInputStream = new FileInputStream(file);
    int i;
    while ((i=fileInputStream.read())!=-1)
    response.getOutputStream().write(i);
    response.getOutputStream().flush();
    response.getOutputStream().close();
    fileInputStream.close();
    catch (Exception e) {
    System.out.println(e.getMessage());
    %>i have a form in index.jsp as
    <form id="frmd" name="frmd" method="post" action="/vpppoint-calculator/cust/resource/jsp/pdfdownload.jsp">
            <input name="sTitle" type="hidden" value="">
            <input name="sPath" type="hidden" value="">
            </form>please help....thanks

  • Can we record a script which can download files?

    Hi, I'm trying to record a script to download file at data collector. I'm using Dialog Manager to handle all the dialogs but it keep failing at the dialog which need to click on Save button. I've edit the Dialog Manager with action like [Save]{ENTER}/ {+S}/ {S} but error still occurred.
    Although the script fails when playback but it can run successfully at Navigation Editor and retrieved the content of the file that I want to download. Besides that, the script also running well when uploaded into monitor. I'm wondering if the script can perform download action as when I check the data collector, there is no files downloaded at the selected location. Can someone help on this? Thanks alot.

    Here is what worked for me:
    Add a dialog with these settings:
    Caption: FileDownload*
    Text: *
    Action: [Save]{click}
    Add another dialog with these settings:
    Caption: Save As
    Text: Save &in:
    Action: [Save]{click}
    Let me know if this doesn't work for you. I am using IE 7.
    If you run through Navigation Editor, the e-Load Agent will download the file and discard the contents. The result is that the file gets downloaded and stresses the web server but doesn't cause storage problems on the agent machine.
    -GateCity_QA

  • About "Upload and download files from ADF into blob type colum."

    hi
    Using JDeveloper 10.1.3.3.0 I have tried the example available for download from this blog post by Jakub Pawlowski:
    "Upload and download files from ADF into blob type colum."
    at http://kuba.zilp.pl/?id=1
    First a thank you to Jakub for this interesting example.
    I have a question about a PDF file that I uploaded using the example.
    The file has a size of 10445518 bytes.
    After I upload that file, the blob column has a value with a size of 10445516 bytes, 2 bytes less.
    SQL> select file_name, dbms_lob.getlength(stored_file) from blob_table;
    FILE_NAME
    DBMS_LOB.GETLENGTH(STORED_FILE)
    ADF-DeveloperGuide-4GL-B25947_01.pdf
                           10445516If I download that file using the example, it has the same size as the blob value, 10445516 bytes.
    If I open the downloaded file, using Adobe Reader 8.1.1, it first shows this message:
    "The file is damaged but is being repaired."
    After that, there is not problem using the PDF file in Adobe Reader.
    I have tried this with both Internet Explorer 6 and Firefox 2.0.0.11.
    I have also tried this with other (smaller) files, and those upload and download correctly.
    question:
    Why are those 2 bytes lost during upload?
    many thanks
    Jan Vervecken

    Hi!
    I can only post you my code that works for me and as I said I had same problems but can't remember what solved them. My code:
      public void fileUploaded(ValueChangeEvent event)
        FacesContext fc = FacesContext.getCurrentInstance();
        UploadedFile file = (UploadedFile) event.getNewValue();
        if (file != null && file.getLength() > 0)
          // here I have some messages written and a call to the method on AM to save the uploaded file to the DB
      private BlobDomain newBlobDomainForInputStream(InputStream in)
        throws SQLException, IOException
        BlobDomain loBlob = new BlobDomain();
        OutputStream out = loBlob.getBinaryOutputStream();
        writeInputStreamToWriter(in, out);
        in.close();
        out.close();
        return loBlob;
      private static void writeInputStreamToWriter(InputStream in,
                                                   OutputStream out)
        throws IOException
        byte[] buffer = new byte[8192];
        int charsRead = 0;
        while ((charsRead = in.read(buffer, 0, 8192)) != -1)
          out.write(buffer, 0, charsRead);
       * Launch the upload - see fileUploaded() for actual upload handling.
       * @return null navigation event - we stay on this page
      public String UploadButton_action()
        if (this.getMyInputFile().getValue() == null)
          FacesContext context = FacesContext.getCurrentInstance();
          FacesMessage message =
            new FacesMessage(FacesMessage.SEVERITY_WARN, JSFUtils.getStringFromBundle("fileupload.emptyfielderror"),
                             null);
          context.addMessage(this.getMyInputFile().getId(), message);
        return null;
       * Setter for inputFile UI Component.
       * @param inputFile inputFile UI component
      public void setMyInputFile(CoreInputFile inputFile)
        this.myInputFile = inputFile;
       * Getter for inputFile UI Component.
       * @return inputFile UI component
      public CoreInputFile getMyInputFile()
        return myInputFile;
      }fileUploaded is a valueChangeListener on inputFile and UploadButton_action is as the name says the action for upload button.
    Hope this helps. If not, than your problem is probably not the same as mine was, although the message about file corrupted was the same.
    Next thing you can check in this case is if your file exceeds max file upload size. I don't know the exact default value, but if the file is too long I think this upload logic will upload only a part of the file and save it to the DB which can also lead to the same file corrupted error.
    You can set the max upload value in web.xml like this:
    <context-param>
    <!-- Maximum memory per request (in bytes) -->
    <param-name>oracle.adf.view.faces.UPLOAD_MAX_MEMORY</param-name>
    <!-- Use 5000K -->
    <param-value>5120000</param-value>
    </context-param>
    <context-param>
    <!-- Maximum disk space per request (in bytes) -->
    <param-name>oracle.adf.view.faces.UPLOAD_MAX_DISK_SPACE</param-name>
    <!-- Use 10,000K -->
    <param-value>15360000</param-value>
    </context-param>

  • How show popup on filedownload button action

    Hi Experts,
    Working on jdev 11.1.1.3.0, ADF BC with rich faces.
    I have requirement in my application like i need to show popup and at the same time need to download file. like on selected rows in the table i have validation on each row, if the validation failed rows i need to show in popup to user at the same time i have validation success rows also those rows i need to generate a file and that file i need to download.
    i have written logic in the command button which has fileDownload, here remaing logic is working fine except showing popup. can any one tell me how to solve this issue.
    Edited by: user5802014 on Aug 19, 2010 5:57 PM

    Hi Frank,
    After chaning actionEvent.forceFullSubmit(); now everything is working fine, but now the problem is if i came from another jsff page to the current page then my file download is not happening i am getting on my browers like error on ....
    javascript:
    function customHandler(event) {
    var exportCmd = AdfPage.PAGE.findComponentByAbsoluteId("pt1:pt_region0:1:cb1")
    var actionEvent = new AdfActionEvent(exportCmd);
    actionEvent.noResponseExpected();
    actionEvent.queue();
    Bean:
    if(downloadFile!=null){
    System.out.println("invoking downloads...............................");
    erks.addScript(context, "customHandler();");
    } if (requestClause != null){
    System.out.println("invoke popup");
    executeSactionCheckVO(requestClause);
    //erks.addScript(context, "showPopup();");
    ADFUtils.invokePopup(this.getP2().getClientId(FacesContext.getCurrentInstance()));
    can you please how to avoid this error or can you please tell me how to call filedownload method in another button action.

  • I need some information about File Download & File Upload

    Hi  All,
    Can any one help me on this, I need some information about File Download & File Upload.
    I read tutorial abt file upload and download but some of methods in tutorial are deprecated so i need clear information abt File upload and Download, if possible Code examples.
    Thanks
    Ragards
    Ravi Golla

    Hi Ravi
    Check out thses links for examples:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/00062266-3aa9-2910-d485-f1088c3a4d71
    /docs/DOC-8661#22 [original link is broken]
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/202a850a-58e0-2910-eeb3-bfc3e081257f
    Otherwise you can simply follow this code for file download
    Use the code like this.
    1) Create the button and bind the action for it.
    2)then write this code in the action.
    3) do not write any thing in the init method.
    try {
    final byte[] content = this.getByteArrayFromResourcePath("C:
    xyz.properties");
    final IWDCachedWebResource resource = WDWebResource.getWebResource(content, WDWebResourceType.UNKNOWN);
    try {
    final IWDWindow window = wdComponentAPI.getWindowManager().createExternalWindow(resource.getAbsoluteURL(), "WD_Filedownload", false);
    window.open();
    catch(Exception e)
    wdComponentAPI.getMessageManager().reportException(new WDNonFatalException(e), false);
    5) writr the method getByteArrayFromResourcePath
    //@@begin others
    private byte[] getByteArrayFromResourcePath(String resourcePath)
    throws FileNotFoundException, IOException {
    FileInputStream in = new FileInputStream(new File(resourcePath));
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    int len;
    byte[] part = new byte[10 * 1024];
    while ((len = in.read(part)) != -1) {
    out.write(part, 0, len);
    in.close();
    return out.toByteArray();
    //end
    Similarly for file upload
    Similarly for upload in to server path also do the same
    IWDAttributeInfo attInfo =
    wdContext.getNodeInfo().getAttribute("upload");
    binaryType =
    (IWDModifiableBinaryType) attInfo.getModifiableSimpleType();
    uploadedName = binaryType.getFileName();
    File filename =new File("
    <server name>
    <folder name>
    "+uploadedName ); );
    try {
    FileOutputStream out = new FileOutputStream(filename);
    out.write(b);
    out.close();
    } catch (FileNotFoundException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();

Maybe you are looking for

  • How do I use a mini display to hdmi adapter to view my laptop on my tv?

    I bought a mini to hdmi adapter and I have an hdmi cable plugged into the TV but I get no picture and there is no other diplay detected by the computer.

  • Dump when run in background

    Hi All, I have a z-report which displays a ALV report. when I run this in background it gets canceled. when i see the log , it has dump and dump is as shown below. A RAISE statement in the program "CL_GUI_CONTROL================CP" raised the excepti

  • Windows update error 80072EFD

    Hi, I have a 2 month old P750 laptop, after needing to do a restore from a drive back up, I now get the error above. I then decided to do a toshiba recovery with a clean install and again get the same result of windows update not being able to connec

  • Importing Problem with one specific CD

    I have previously imported this disc. It is disc 2 of a 2 disc set. I have no problem getting iTunes to recognize the other disc in the set. Now after clearing all previous info and files related to this CD I cannot get iTunes to import it. The iTune

  • Whats next for the ipod.

    like the ipod movie.