• 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: Help of FileDownload
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help of FileDownload


  • Subject: Re: Help of FileDownload
  • From: Robert Walker <email@hidden>
  • Date: Sun, 16 Nov 2003 22:11:54 -0500

Kranthi,

In you code below you are setting the content-type to "text/html" which tells the browser that it will receive html text. You must set the content-type to inform the browser to either handle the content with a plug-in or just download the file to disk. Example: If you are attempting to download a PDF file the content-type would be "application/pdf" This is a clue to the browser that it should use the PDF plug-in to display the content. If you want to force the download of the file you can set the content-type to "application/octet-stream"

To use my FileDownloader class you would do something like this in you action method:

public WOComponent dowloadFileAction() {
FileDownloader myDownloader = (FileDownloader)pageWithName("FileDownloader");
myDownloader.setMimeType("application/pdf");
myDownloader.setFileName("My File.pdf");
myDownloader.setData(fileData);
return myDownloader;
}


On Nov 16, 2003, at 6:19 AM, Kranthi Sagar Borra wrote:

Hi Robert. <<Picture 1.pdf>>

Thanks a lot for the help.I downloaded the file ,but I still have few queries.This is what I have done.

public void appendToResponse(WOResponse aResponse, WOContext aContext) {
super.appendToResponse(aResponse,aContext);



aResponse.setContent(data);
aResponse.setHeader("text/html; charset=UTF-8;","content-type");
if (fileName != null){
aResponse.setHeader("attachment;filename=\"" +
fileName + "\"", "content-disposition");



} }

and above this I have defined data as "NSData data=new NSData(downloadedFile);".where downloadedFile is the file on the server , that should be downloaded.

But when I click on the file that is to be downloaded.The response is created and I am going into a new page where the raw data is getting shown.Picture 1.pdf shows what I am seeing.But this is not what I want.I wanted to downlod the file on my desktop.So can you please tell me what I can do.I think the link that you have provided me does the same to download.Even my requirement is the same.Can you please help me.Thank you.


Regards,

Kranthi Sagar
Extn:6799
Direct:0824-2226799
Cell:9845791246



----------
From: 	Robert Walker
Sent: 	Sunday, November 16, 2003 10:38 AM
To: 	Kranthi Sagar Borra
Cc: 	WebObjects Dev
Subject: 	Re: Help of FileDownload

Kranthi,

You're welcome to use my FileDownloader class.

You can find it here:
http://homepage.mac.com/robertwalker1

On Nov 15, 2003, at 8:19 AM, Kranthi Sagar Borra wrote:

Hi

There is WOFileUpload feature in WO that uploads my file from my hard
disk to the application server.So is there any such thing for
downloading the file from the application server to my desktop.Thanks

Regards,
Kranthi Sagar
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.


--
Think Different
Robert Walker
www.robertwalker1.com



<Picture 1.pdf>
--
Think Different
Robert Walker
www.robertwalker1.com
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: disable back button of the browser
  • Next by Date: RE: disable back button of the browser
  • Previous by thread: Re: Help of FileDownload
  • Next by thread: WebObjects and Web Services
  • Index(es):
    • Date
    • Thread