Skip to Content

Reading File name, mimetype and size from FileUploadUIElement


I am using FileUploadUIElement and I need to read filename, type and size in my Button click action.

I have seen the standard Test UI elements component WDR_TEST_EVENTS which does this in wdDoModifyView method.

But is there any way to read them outside wdDoModifyView ? In a normal custom action event?

Thanks and regards,

Amey Mogare

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 10, 2009 at 12:57 PM

    Hi, Yes you can definately do the same in any of the custom events implemented. You will have to create a global attribute in the component controller say g_upload type ref to cl_wd_file_upload ( mark the Public checkbox ).

    " Now in your view modify instead of, 
      file_upload2 ?= view->get_element( 'FILEUPLOAD2' ).
    " you say,
        wd_comp_controller->g_upload ?= view->get_element( 'FILEUPLOAD2' ).
    Now create an action for you button and copy the rest of the code from view modfiy and place it in this method, using wd_comp_controller->g_upload get the required values as follows.
    * get the content of the filename property
      filename = wd_comp_controller->g_upload->get_file_name( ).
    * get the content of the mime-type property
      mime_type = wd_comp_controller->g_upload->get_mime_type( ).
      wd_context->get_attribute( exporting name = 'FILECONTENT' importing value = filecontent ).
      size = xstrlen( filecontent ).
    Regards, Radhika.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.