Re: File download
Re: File download
- Subject: Re: File download
- From: Greg <email@hidden>
- Date: Fri, 1 Jul 2005 13:55:04 +1000
public void appendToResponse(WOResponse response, WOContext context) {
super.appendToResponse(response, context);
URL file = null;
NSData fileContents = null;
try {
file = new URL("file", null, img.path() +"/"+ img.print());
fileContents = new NSData(file);
response.setContentEncoding("UTF8");
response.setHeader("image/jpeg", "content-type");
response.setHeader("attachment; filename=" + img.filename
(),"Content-Disposition");
response.setContent(fileContents);
response.setStatus(WOMessage.HTTP_STATUS_OK);
} catch (Exception e) {
System.out.println("Error Downloading file: " + e);
}
}
On 01/07/2005, at 1:41 PM, Valerio Luccio wrote:
Hi all,
this has been driving me nuts. I'm looking for the equivalent of
WOFileupload to do a download. In other words, I want to duplicate
the behavior of the "Save as ..." where you can chose a directory
and specify a file name.
--
Valerio Luccio (212) 998-8736
Center for Brain Imaging 4 Washington Place, Room 156
New York University New York, NY 10003
"In an open world, who needs windows or gates?"
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40framedphotographics.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden