Let's follow up this discussion at the Neptune Community
(this forum will be kept in read-only mode)
can i upload an Image with the FileUploader and the image displays in an Image Object on Tablet/Desktop? (currently only the name of the picture is displayed)
Thanks & Regards
You upload the image with the fileUploader and send it to SAP. Then add it to a structure or internal table and send it back to the client/device. Then you can display the data.
When you use an image binded to src, the image data needs to be base64 encoded and start with "data:image/jpeg;base64,"
Example method for getting HR Image:
method get_data_image. data: lv_toahr type toahr, it_arch type table of docs, it_bin type table of tbl1024, lv_bin_length type sapb-length, lv_length type i, lv_xstring type xstring, lv_object_id type toahr-object_id. * Build ID concatenate wa_employee_list-pernr '%' into lv_object_id. * Get Image Archive ID select single * from toahr into lv_toahr where sap_object eq 'PREL' and object_id like lv_object_id and ar_object eq 'HRICOLFOTO'. check sy-subrc eq 0. * Get Image from Content Server clear it_bin. clear lv_xstring. clear lv_bin_length. call function 'ARCHIVOBJECT_GET_TABLE' exporting archiv_id = lv_toahr-archiv_id document_type = 'PREL' archiv_doc_id = lv_toahr-arc_doc_id importing binlength = lv_bin_length tables binarchivobject = it_bin exceptions error_archiv = 1 error_communicationtable = 2 error_kernel = 3 others = 4. lv_length = lv_bin_length. call function 'SCMS_BINARY_TO_XSTRING' exporting input_length = lv_length importing buffer = lv_xstring tables binary_tab = it_bin exceptions failed = 1 others = 2. call function 'SCMS_BASE64_ENCODE_STR' exporting input = lv_xstring importing output = wa_employee_list-image. concatenate 'data:image/jpeg;base64,' wa_employee_list-image into wa_employee_list-image. endmethod.
I know that the method Upload( ) of the object FileUploader starts an ajax call, but it seems that this call has not the option to define some send/receive parameters.
How can we receive the structure/internal table with the uploaded content in a single call?