• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Downloading a file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Downloading a file


  • Subject: Re: Downloading a file
  • From: wojingo <email@hidden>
  • Date: Mon, 23 Jan 2006 12:36:45 +1030

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@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Downloading a file
      • From: Miguel Arroz <email@hidden>
References: 
 >Downloading a file (From: Miguel Arroz <email@hidden>)

  • Prev by Date: Re: Managing EOF caching
  • Next by Date: Session timeout question
  • Previous by thread: Downloading a file
  • Next by thread: Re: Downloading a file
  • Index(es):
    • Date
    • Thread