cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding file upload

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.

Former Member
0 Kudos

Check if the data type of the attributes is XSTRING and you have bound the data property of both fileupload and filedownload uielements.

Radhika.

Former Member
0 Kudos

Hi,

I have checked the data type of attributes it s in xstring type only and then i have bound the data property for file upload and download also.

but again it s showing the same output.

With Regards,

R.Dhineshraj.

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hi ,

Thanks for ur continuous reply.

I have a doubt regarding uploading of the image.whether the image belongs to jpeg or else bitmap?

due to this reason is there any possibility to affect the ouput?

Dhineshraj.

Former Member
0 Kudos

Hi,

No that should not affect and i have tested with both JPEG and BITMAP and its working fine with me.

Are you facing problems with the second approach as well ?

Radhika.

Former Member
0 Kudos

Hi,

Ya i am facing the same problem in second approach also i.e when i click the hyperlink then it will shows the page as empty.

Dhineshraj.

Former Member
0 Kudos

Hi,

thanks for ur answer.

I got the output.Actually teh problem i have bound the filename property in the data type xstring.

R.Dhineshraj

Former Member
0 Kudos

ok great ! Kindly close the thread.

Regards,

Radhika.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

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

Regards,

Runal