Miguel Arroz wrote:
Hi!
I need to upload and download files to/from my application. The files
are stored on the DB.
The download may only be done by logged in users, ie, it's not
public. To implement that, I created a component and a dynamic element.
The component has only the dynamic element, and the dynamic element
appends the file data to the responde and sets the correct content-type
header. So far, so good.
The only problem is that, when people download the file to their hard
drive, the file name is something like 1.5.3.9.5.3... you know! :) Is
there any easy way to make the file name look decent (ie, be the same
as the name of the file when it was uploaded)? I store the file name on
the database, so it's right there, just need to find a way to tell the
browser to use it.
Yours
Hi,
try something like this.
public void appendToResponse(WOResponse aResponse, WOContext aContext) {
super.appendToResponse(aResponse, aContext);
aResponse.setHeader("text/csv", "content-type");
aResponse.setHeader("attachment;filename=wip.csv",
"Content-Disposition");
}
cheers,
-shaun
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]