Re: Downloading Files
Kieran Kelleher <[email protected]>
| Newsgroups | gmane.comp.web.webobjects.devel |
|---|---|
| Message-ID | <[email protected]> |
This https tip may or may not help....
http://homepage.mac.com/kelleherk/iblog/C463983418/E102943740/index.html
On Aug 30, 2006, at 3:59 AM, Cheong Hee (Datasonic) wrote:
>
> When I upload the file on a Mac (Safari) the file name is
> successfully grabbed and stored in the DB along with the Data.
> Using Windows and IE6, I have to manually parse the filename to
> eliminate the "c:\DOS\Crap\Path\" from the filename. Again, no
> problem (though annoying).
>
> It is annoying indeed...and extra effort to make it cross-platform.
>
> On your downloading issue, I do not encounter the same in Linux
> platform. And cross-checked headers with mine, it looks there is
> nothing missing. Just a question, do you try to download the file
> via SSL/IE?
>
> Cheers
>
> Cheong Hee
>
>
> On download (Mac and Safari) things work as expected. Win IE 6,
> however, does not populate the filename from the download link.
> Instead, the file is named based on the number.number.number.etc
> internal url created by WO. The file successfully downloads and
> will open when the name (including the extension) is manually added.
>
> In a nutshell, is there some header (that I have missed) that can
> pass the filename upon download to IE 6? Below is the generic code
> for the download component called from the hyperlink (taken almost
> exactly as it appears on this list earlier)...
>
> Regards,
> Mike
>
>
> import com.webobjects.foundation.*;
> import com.webobjects.appserver.*;
> import com.webobjects.eocontrol.*;
> import com.webobjects.eoaccess.*;
>
> public class FileDownload extends WOComponent {
> protected UploadedDocument soapFile;
> protected String mimeType;
>
>
> public FileDownload(WOContext context) {
> super(context);
> // mime type default
> mimeType = "application/octet-stream";
> }
>
> public void appendToResponse(WOResponse response, WOContext
> context) {
> response.setHeader(mimeType, "content-type");
>
> response.setHeader("attachment; filename=" +
> soapFile.fileName(), "content-disposition");
> response.setHeader(new Long( soapFile.fileData().length
> () ).toString(), "content-length");
> response.setContent(soapFile.fileData());
> // super.appendToResponse(response,context);
> }
>
> public UploadedDocument soapFile()
> {
> return soapFile;
> }
> public void setSoapFile(UploadedDocument newFile)
> {
> soapFile = newFile;
> }
>
> }
>
>
>
>
> _______________________________________________
> WebObjects-dev mailing list
> [email protected]
> http://www.omnigroup.com/mailman/listinfo/webobjects-dev
> _______________________________________________
> WebObjects-dev mailing list
> [email protected]
> http://www.omnigroup.com/mailman/listinfo/webobjects-dev
_______________________________________________
WebObjects-dev mailing list
[email protected]
http://www.omnigroup.com/mailman/listinfo/webobjects-dev