on 06-30-2009 6:06 AM
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hai Radhika,
Thanks for your answer.
I have done all the steps that u had mentioned.After uploading the image, and then i have clicked the button.After that if i will click the hyperlink of filedownload ui element then i was not able to see the image that was uploaded.Instead of that,it will return the output in the text format (it returns a letter A) .
How to see my uploaded image?
With Regards,
R.Dhineshraj.
ok ..Try this way...the attribute that you have bound to your data property of teh fileupload uielement, bind the same to the data property of the filedownload.
Comment all the code that is in the button Action. just keep it blank for the purpose of triggering the event.
Both the approach wrks fine for me..but the one i have mentioned now is with no coding and minus 1 attribute..
Try it out.
Radhika.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.