Download capability
Download capability
- Subject: Download capability
- From: Erwin <email@hidden>
- Date: Sun, 31 Oct 2004 16:08:17 +0100
I am testing the download capability ... it runs well, the downloaded picture is displayed into the navigator
but I would like to give the user the possibility to store the downloaded file into his own file system....
wwhat should I modify ?
here is teh code I am using ::
.....
if (filepath != null && filepath.length() > 0) {
URL file = null;
NSData fileContents = null;
String fileName = NSPathUtilities.lastPathComponent(filepath );
String mimeType = WXFileUtilities.mimeTypeFromPath(filepath);
try {
file = new URL("file", null, filepath);
fileContents = new NSData(file);
aResponse.setContentEncoding("UTF8");
aResponse.setHeader(mimeType, "content-type");
aResponse.setHeader("filename=" + fileName,"Content-Disposition");
aResponse.setContent(fileContents);
aResponse.setStatus(WOMessage.HTTP_STATUS_OK);
} catch (Exception e) {
NSLog.err.appendln("Error downloading file: " + e);
aResponse = new WOResponse();
aResponse.appendContentString("Error downloading file: " + e);
}
}
return aResponse;
....
_______________________________________________
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