• 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: File name issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: File name issue


  • Subject: RE: File name issue
  • From: "Yury Peskin" <email@hidden>
  • Date: Mon, 7 Apr 2008 12:15:34 -0500

Thanks Chuck.
It works as expected.

Yury Peskin
Director of IT Services
Cycle Software Services
8711 Lyndale Ave S.
Bloomington, MN 55420

-----Original Message-----
From: webobjects-dev-bounces+ypeskin=email@hidden [mailto:webobjects-dev-bounces+ypeskin=email@hidden] On Behalf Of Chuck Hill
Sent: Monday, April 07, 2008 11:50 AM
To: Yury Peskin
Cc: email@hidden
Subject: Re: File name issue


On Apr 7, 2008, at 9:17 AM, Yury Peskin wrote:
> Hello list,
> I'm having a problem with the file download.  I'd like to be able to
> have the name of the file show up in the save as box, but right now
> I'm getting the webobjects form id instead. This is on any windows
> browser: Firefox, or IE 7.
> Any ideas?
> Thanks,
> Yury
>
> Here's my code:
>
> 	public void appendToResponse(WOResponse r, WOContext c) {
> //		 super.appendToResponse(r, c);
> 		if(proof != null && proof.pdfPath().length() > 0)
> 		{
> 			File f = new File(Application.PROOFSDIR + File.separator +
> proof.pdfPath());
> 			try
> 			{
> 				NSData resultData = new NSData(new FileInputStream(f),
> (int)f.length());
> 				if(resultData != null)
> 				{
> 					r.disableClientCaching();
> 					r.removeHeadersForKey("Cache-Control");
> 					r.removeHeadersForKey("pragma");
> 					r.setHeader("application/pdf", "content-type");
> 					r.setHeader("inline; filename=\"" + Application.PROOFSDIR +
> proof.pdfPath() + "\"", "content-disposition");

Try attachment; instead of inline;


> 					r.setHeader(Integer.toString(resultData.length()), "content-
> length");
> 					r.setContent(resultData);
> 				}
> 			}
> 			catch(Exception e)
> 			{
> 			}
> 		}
> 	}
>
> _______________________________________________
> 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

--

Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects





 _______________________________________________
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

 _______________________________________________
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

References: 
 >File name issue (From: Yury Peskin <email@hidden>)
 >Re: File name issue (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: File name issue
  • Next by Date: Re: Best Way® to test for existence of a relationship
  • Previous by thread: Re: File name issue
  • Next by thread: Development vs Deployment Error
  • Index(es):
    • Date
    • Thread