RE: FileDownload
RE: FileDownload
- Subject: RE: FileDownload
- From: "Kranthi Sagar Borra" <email@hidden>
- Date: Sun, 16 Nov 2003 20:31:50 +0530
- Thread-topic: FileDownload
Hi
I used "application/octet-stream" as the MIME type.But this downloads the file with a different name every time like 12345.jpg instead of hello.jpg.Can somebody please tell me how I can resolve this issue..Thank you.
Regards,
Kranthi Sagar
> ----------
> From: Kranthi Sagar Borra
> Sent: Sunday, November 16, 2003 7:59 PM
> To: Richard Bruch
> Cc: email@hidden
> Subject: RE: FileDownload
>
> Hi Richard
>
> I think the probelm is with the mime type that I have set.can somebody tell em what is the appropriate MIME type that I need to use in such situation.Thanks.
>
> Regards,
> Kranthi Sagar
>
>
>
>
> > ----------
> > From: Richard Bruch
> > Sent: Sunday, November 16, 2003 5:02 PM
> > To: Kranthi Sagar Borra
> > Subject: Re: FileDownload
> >
> > Hi Kranthi,
> >
> > i'm not sure but i think, the problem is with the mime type. You set it to
> > text/html so the browser feels responsible for interpreting the contents as it
> > does with any other html page(they all have the text/html type). Should your
> > file be a text/html file try to set the mime type to text/plain for example,
> > otherwise to whatever appropriate. If the browser thinks it is not able to
> > handle the contents it will offer you to store it locally.
> >
> > Regards,
> >
> > Richard
> >
> >
> > ----- Original Message -----
> > From: "Kranthi Sagar Borra" <email@hidden>
> > To: "Richard Bruch" <email@hidden>
> > Sent: Sunday, November 16, 2003 12:21 PM
> > Subject: RE: FileDownload
> >
> >
> > <<Picture 1.pdf>>
> > Hi Richard,
> >
> > Thanks a lot for the help.I think that is what I should do 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.Thank you.
> >
> > Regards,
> >
> > Kranthi Sagar
> > Extn:6799
> > Direct:0824-2226799
> > Cell:9845791246
> >
> >
> >
> > > ----------
> > > From: Richard Bruch
> > > Sent: Sunday, November 16, 2003 1:39 AM
> > > To: Kranthi Sagar Borra
> > > Cc: email@hidden
> > > Subject: FileDownload
> > >
> > > Hello Kranthi,
> > >
> > > supposed you have an object "data" with data loaded from the desired server
> > file
> > > you can build a WOResponse object and return it as result of a given direct
> > > action.
> > >
> > > r.setHeader(data.getMimetype(),"content-type");
> > > r.setHeader("attachment;
> > > filename=\""+data.getFilename()+"\"","content-disposition");
> > > if(data.stringData != null) // data is in a string
> > > r.appendContentString(data.stringData.toString());
> > > else // data is in an NSData instance
> > > r.appendContentData(data.getRawData());
> > >
> > > Regards,
> > >
> > > Richard
> _______________________________________________
> 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.>
_______________________________________________
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.