retrieving a blob stored file from mysql
I am trying to implement a feature on my site where users can upload a file (typically a tif file) for other users to download. I have the upload working fine and the download side works with Linux with Mozilla (my development system) but IE6 won't open the file as if it were a regular link. When you choose "save as" it works but if you choose "open with" to open the file with some kind of image viewer Windows complains that the temporary file does not exist. This is what I'm doing: 1. I link to my python script from my dtml document <a href="get_attachment?attachment_id=&dtml-attachment_id;">&dtml-doc_name;</a> 2. get_attachment result = context.sqlSelAttachmentByID(attachment_id = attachment_id) container.REQUEST.RESPONSE.setHeader('content-type', result[0].type) container.REQUEST.RESPONSE.setHeader('content-disposition', 'attachment;filename=' + result[0].doc_name) #content-disposition can use either: application, inline, or attachment return result[0].attachment I've tried using all 3 of those content-disposition settings with the same results. Does anyone know what I'm doing wrong? Thanks, Aaron Kunkle
I am trying to implement a feature on my site where users can upload a file (typically a tif file) for other users to download. I have the upload working fine and the download side works with Linux with Mozilla (my development system) but IE6 won't open the file as if it were a regular link. When you choose "save as" it works but if you choose "open with" to open the file with some kind of image viewer Windows complains that the temporary file does not exist.
This is what I'm doing: 1. I link to my python script from my dtml document <a href="get_attachment?attachment_id=&dtml-attachment_id;">&dtml-doc_name;</a>
2. get_attachment result = context.sqlSelAttachmentByID(attachment_id = attachment_id) container.REQUEST.RESPONSE.setHeader('content-type', result[0].type) container.REQUEST.RESPONSE.setHeader('content-disposition', 'attachment;filename=' + result[0].doc_name) #content-disposition can use either: application, inline, or attachment return result[0].attachment
IE (and/or Windows) is known to almost religiously ignore any attempts by the server to tell it what type some content is other than its filename. When you "save as" it will realize what it is looking at, but when being presented "inline" you are generally at the mercy of file extensions. You may need to find a way for your link to end in '.tif' or whatever it really is. Problems with this OS misfeature are dreadfully common. --jcc -- "Code generators follow the 80/20 rule. They solve most of the problems, but not all of the problems. There are always features and edge cases that will need hand-coding. Even if code generation could build 100 percent of the application, there will still be an endless supply of boring meetings about feature design." (http://www.devx.com/java/editorial/15511)
Well, I am saving and then returning the full filename (including file extension) if thats what you mean. Both Mozilla and IE show the correct filename when asking me what to do with the file. But there's a couple weird things that I just noticed: 1. Opening the tif files with Adobe PhotoPaint works. I was originally trying to open them with the "kodak imaging" program that comes with Windows and thats where I get the error. 2. When IE saves the file to the temp directory it stores it as whatever[1].tif instead of whatever.tif like it should and does do when I just to save it to disk. Any ideas? Thanks Aaron Kunkle On Thu, 2003-10-02 at 16:35, J Cameron Cooper wrote:
IE (and/or Windows) is known to almost religiously ignore any attempts by the server to tell it what type some content is other than its filename.
When you "save as" it will realize what it is looking at, but when being presented "inline" you are generally at the mercy of file extensions. You may need to find a way for your link to end in '.tif' or whatever it really is. Problems with this OS misfeature are dreadfully common.
--jcc
participants (2)
-
Aaron Kunkle -
J Cameron Cooper