Skip to Content
avatar image
Former Member

Regarding file upload

hai experts,

I have to upload my photo using file upload UI element and then i have to see the uploaded image

how to acheive this ?

With Regards,

R.Dhineshraj.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Jun 30, 2009 at 07:35 AM

    Hi ,

    You can use fileUpload and file download Uielements

    Follow these steps:

    1. Create a node 'FILEUPLOAD' with 2 attributes

    a) FILECONTENT type XSTRING

    b) FILENAME type STRING

    2. create a node 'FILEDOWNLOAD' with 1 attribute

    a) DOWNLOAD type XSTRING

    3. Goto the layout tab

    a) Place a fileupload uielement and a button next to it for uploading the image

    b) Bind the Data property with the attribute 'FILECONTENT' and filename property with the attribute 'FILENAME'

    c) Place a filedownload uielement on the layout

    d) Bind the data property of thr filedownload uielement with the attribute 'DOWNLOAD'

    4.Create create an action for the button, the Event 'onAction'.

    5. In this method write the following code to read the content and set the download attribute

    data: l_node type ref to if_wd_context_node.
    data: l_content type xstring.
     
    l_node = wd_context->get_child_node( ' FILEUPLOAD'  ).
    l_node->get_attribute(  exporting name = 'FILECONTENT' 
                    importing value = l_content ). " l_content will be your image in xstring format
    
    data: l_node1 type ref to if_wd_context_node.
    
    l_node1->wd_context->get_child_node( ' FILEDOWNLOAD'  ).
    l_node1->set_attribute( exporting name = 'DOWNLOAD'
                                   value  = l_content ) . " retrieved frm above

    Now when you run the application you will see a hyperlink for filw download, once you upload your image and click the button that content is set to your download element. Click the hyperlink and you will see the image that was uploaded.

    You can also Check standard component WDR_TEST_EVENTS.

    Regards,

    Radhika.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 30, 2009 at 05:34 AM

    Hi,

    Check Thomas Jung's e-Learning on AcfUpload and AcfDownlaod in this thread.

    new-web-dynpro-abap-related-elearnings-available

    Regards,

    Runal

    Add comment
    10|10000 characters needed characters exceeded