cancel
Showing results for 
Search instead for 
Did you mean: 

Download mutiple images

Former Member
0 Kudos

Hi Experts,

I have uploaded images and saved in table in xstring format.

Multiple images may be uploaded for 1 entry.

I want to download those images and display them as an attachment or smthng, but basically the user should be able to view all the images uploaded for an entry.

I tried using file_download for this purpose, but it shows on 1 image not multiple.

Any help would be appreciated.

Thank You.

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

File download will only download one item at a time. If you want to download multiple items, you would need to use ZIP compression to place them all together in one binary string. You can use the class CL_ABAP_ZIP to do this.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I was asked in email to provide an example of how to use the ZIP library:

data izip type ref to cl_abap_zip.
 create object izip.
  loop at images assigning <wa_image>
    izip->add( name = <wa_image>-img_name
                content = <wa_image>-content ).
 endloop.
    l_xstream = izip->save( ).

In this example, each image is added to the ZIP file (and compressed). You then get the full binary content for the zip file back into the i_xstream variable via the izip->save() call. This i_xstream is then what you download.

cl_wd_runtime_services=>attach_file_to_response(
      i_filename      = l_name
      i_content       = l_xstream
      i_mime_type     = l_mimetype ).

Former Member
0 Kudos

Hi Thomas,

Thanks for the quick response.

Answers (0)