Skip to Content
avatar image
Former Member


if i have a webdynpro project that have file upload and download feature

when i click upload the file will store in directory specify by me,

later on...when i try to download the file....

how to the system know which directory i stored......

or the system will only retrieve from specific location ?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Mar 22, 2007 at 03:21 AM


    You will have to specifiy the location from which the file has to be downloaded.

    In your case snce you have uploaded the file to a specific location, you can give the same location to read the file for download.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi

      The you have not mentioned the file directory. The other way is to create a dir in ur server where you can handle ur files. for e.g : u can create file in ur C directory as

      FileInputStream in = new FileInputStream(new File("C:
      " + resourcePath));

      and then u can retrieve the file.


  • avatar image
    Former Member
    Mar 22, 2007 at 06:16 AM


    All you have done is expose your application to Internet using Web Dispatcher isnt it? If your application is visible, the download shouldnt be a problem. Please try the code snippet that I have sent to you.



    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 22, 2007 at 04:44 AM


    I understand that you are using the FileDownload UI element of WebDynpro. This UIelement appears as a link, on click of which the file gets downloaded. Here is how the download functionality has to be coded

    Insert the File Download UI element into the View.

    The File Download UI element has various properties out of which only the data property is bindable and mandatory.

    Bind this property to a context attribute of type binary.(Lets call the attribute filedata)

    The file to be downloaded will be stored in this attribute.

    The File Download element will be active only if there is data in the above attribute.

    We have to write the file to be downloaded to the attribute.

    Lets now look into the coding part how this can be achieved.

    Consider that you have created a value attribute “filedata” of type binary in the context of the view. Also consider that the name of the file in server is “test.doc”.At this moment the attribute does not have any data.



    File input = new File("C:

    int length =(int)input.length();

    //Create a byte array b to hold the file

    byte b[] = new byte[length];

    FileInputStream in = new FileInputStream(input);

    //Reading the file to a byte array b;


    //Setting the data from the byte array to the context element.



    catch(Exception ex)


    wdComponentAPI.getMessageManager().reportSuccess("Error in File



    // Structure information of the context attribute

    IWDAttributeInfo attinfo = wdContext.getNodeInfo().getAttribute("filedata");

    IWDModifiableBinaryType binaryType = (IWDModifiableBinaryType) attinfo.getModifiableSimpleType();

    // Default File name which appears when opened on client machine


    //Explicitly setting the file type


    Kindly revert back if you have doubts.

    Thanks and regards


    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      something i want to highlight here.....

      actually i can successfully download the file with popup external windows when it is locally...means....localhost/webdynpro/MailApp


      not when i published out for public to access http://xxx/webdynpro/MailApp

      Any reason...for this ?

      Or my coding is wrong...