-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I do have some media files coming from database as byte array. How can I retrieve the direct url of this file in ZK ?
I believe that Image component does something like this since it does sets the "src" attribute with a dynamic generated url (but it only works with images).
Just to illustrate what I want to reproduce:
1 - I do have my file being created this way
Media media = new AMedia(myFile.getName(), myFile.getFormat(), null, myFile.getByteArr());
//"myFile" is the object of my entity that holds my file info
2 - I want to retrieve the direct url for my file
getMyUrl(media); //retrieves the path like "/foobar/view/myfile.ext"
Obs: Filedownload.save()
does not solve my problem since it doesn't provide any way of retrieving the url instead of just downloading it.
To generate a media URI that links to your current desktop you can use the method desktop.getDownloadMediaURI(...)
I prepared a simple example illustrating the usage: http://zkfiddle.org/sample/3kt1afe/2-download-media-link
Asked: 2018-06-19 19:27:57 +0800
Seen: 11 times
Last updated: Jun 20 '18