cancel
Showing results for 
Search instead for 
Did you mean: 

File Download In Button not link

Former Member
0 Kudos

Hi

I want to download a file from my application for that i have used the file download UI element but that file download looks like a link but i want it to look like a button not link for that i tried to change its type property but it don't give me looks like button so please help me out in downloading the file by clicking a button (not link)

Thanks in advance

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member182372
Active Contributor
0 Kudos

Hi Ninad,

Insert button, for action handler put something like:


	final byte[] content = //get content of the file;
	final IWDCachedWebResource resource = WDWebResource.getWebResource(content, WDWebResourceType.<APPROPRIATE_MIME_TYPE>);
	try {
		final IWDWindow window = wdComponentAPI.getWindowManager().createExternalWindow(
	resource.getAbsoluteURL(), "Window title", false);
		window.open();
	} catch(Exception e) {
		wdComponentAPI.getMessageManager().reportException(new WDNonFatalException(e), false);
	}

Best reagrds, Maksim Rashchynski.

Former Member
0 Kudos

Hi Maksim Rashchynski,

This will not do because i have to download a XML file and when i open new browser XML FILE is opened in that browser i need a functionality like where i can click on save button and choose the path to save the file like File download element do

Thanks

Ninad

former_member182372
Active Contributor
0 Kudos

What mime type are you passing?

Try to use WDWebResource.getWebResource( content, WDWebResourceType.UNKNOWN );

Former Member
0 Kudos

Ninad,

Did this solution work?

I tried it but it still opens in the new browser window and does not ask the option of save or open.

Regards,

Anand Bhambure

Former Member
0 Kudos

Hi Anand,

Its working but you have to set the content type unkown so that it will ask to open/save see the bellow like for reference

WDWebResource.getWebResource( content, WDWebResourceType.UNKNOWN );

Ninad