Re: FileDownload
Re: FileDownload
- Subject: Re: FileDownload
- From: Serge Froment <email@hidden>
- Date: Mon, 17 Nov 2003 10:42:24 -0500
Hi Kranthi,
Here is the code I use in a direct action to trigger file downloading.
This works with Safari and IE on both Mac and Windows machines. The
file is downloaded with the file name I pass in the Content-Disposition
header.
public WOResponse downloadAction()
{
String desktopRequest = (String) request().formValueForKey("id");
Desktop desktop = Application.desktopWithID(new
Integer(desktopRequest));
desktop.photo().incrementDownloadCount();
WOResponse response = new WOResponse();
response.setHeader("data/binary", "Content-Type");
response.setHeader("attachment;filename=" + desktop.filename(),
"Content-Disposition");
response.setContent(desktop.desktopImage().image());
return response;
}
Le 16 nov. 2003, ` 10:01, Kranthi Sagar Borra a icrit :
> I used "application/octet-stream" as the MIME type.But this downloads
> the file with a different name every time like 12345.jpg instead of
> hello.jpg.Can somebody please tell me how I can resolve this
> issue..Thank you.
>
Serge Froment
http://www.serge-froment.com
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.