I realized I didn't explicitly answer your question:

I can upload any file type into the db, and download it to a client.  The 
only restriction is that the file extension be in the mime type table, a 
portion of which is below:

 id     type    extension
        38      video/quicktime         .mov
        37      video/mpeg      .mpg
        36      text/xml        .xml
        35      text/tab-separated-values       .tsv
        34      text/sgml       .sgm
        33      text/rtf        .rtf
        32      text/richtext   .rtx


>Have you done this with __PDF__ files stored in __MSSQL__?  If so, how
>are you loading the files into the db?
>
>There is more to this issue than just how to set the HTTP header for
>display of pdf files.  I can read the file contents and display as a
>pdf; it's the database piece that causes a problem.  I suspect Bengt is
>running into the same issues.
>
>Thanks.     j
>
>
>> -----Original Message-----
>> From: Bill Conlon [mailto:[EMAIL PROTECTED] 
>> Sent: Wednesday, September 17, 2003 2:41 PM
>> To: [EMAIL PROTECTED]
>> Subject: RE: Witango-Talk: PDF stored in db?
>> 
>> 
>> Here's what works for me:
>> 
>> 1.  Query my db (three tables for mime type, media meta data, and the 
>> media data itself -- but you could put this into one table)
>> 
>> 2.  Set up the request scope variables
>> <@ROWS>
>> <@ASSIGN NAME="type" SCOPE="request" VALUE=<@COLUMN 
>> "mime.type">> <@ASSIGN NAME="date" SCOPE="request" VALUE=<@COLUMN 
>> "media_description.date_modified">>
>> <@ASSIGN NAME="size" SCOPE="request" VALUE=<@COLUMN 
>> "media.size">> <@ASSIGN NAME="filename" SCOPE="request" 
>> VALUE=<@COLUMN "media.filename">> <@ASSIGN NAME="file" 
>> SCOPE="request" VALUE=<@COLUMN "media.data">> </@ROWS>
>> 
>> 3.  Set up the HTTP header
>> <@PURGERESULTS><@assign name="encodeResults" scope="request" 
>> value="false"><@ASSIGN NAME="httpHeader" SCOPE="request" 
>> encoding="none" 
>> VALUE="HTTP/1.1 200 OK<@CRLF>Server: Apache 
>> 2.0.046<@CRLF>Accept-Ranges: 
>> bytes<@CRLF>Content-Type: @@request$type<@CRLF>Content-Disposition: 
>> inline; filename=@@request$filename<@CRLF>Last-Modified: <@VAR 
>> NAME="date" scope="request" format="datetime"><@CRLF>Content-Length: 
>> @@request$size<@CRLF><@CRLF>"><@VAR NAME="file" SCOPE="request" 
>> ENCODING="none">
>> 
>> >Hiya Bengt!
>> >
>> >1.  Check the binary data in your blob against your original 
>> file.  How 
>> >are you putting the PDF in?
>> >
>> >2.  Check the pdf binary data that is displayed against the 
>> binary data 
>> >in the original.
>> >
>> >I've still not gotten this to work properly, due to a null character 
>> >used in the PDF format.  That characters always truncated the data 
>> >either at upload or at read; I haven't found a workaround 
>> yet.  Other 
>> >folks said they had gotten it working, but they were either 
>> doing image 
>> >files rather than PDF, or were not on MSSQL.  (I had to drop 
>> the issue 
>> >when I hadn't managed to resolve it after several days.)
>> >
>> >If you can give me more info about how your process works, I'll pull 
>> >the pertinent info I've collected and forward it.
>> >
>> >Good luck!
>> >jamileh
>> >
>> >
>> >> -----Original Message-----
>> >> From: Bengt Bredin [mailto:[EMAIL PROTECTED]
>> >> Sent: Wednesday, September 17, 2003 9:28 AM
>> >> To: [EMAIL PROTECTED]
>> >> Subject: SV: Witango-Talk: PDF stored in db?
>> >> 
>> >> 
>> >> 
>> >> Hi all !
>> >> 
>> >> I have tried out this example from Troy and Scott but can't
>> >> get it to work. It's probably some misunderstanding from me, 
>> >> but I try to get some help anyway. So I pull out my blob, a 
>> >> pdf file from the db (MSSQL) and use just a test taf to do this:
>> >> 
>> >> <@ASSIGN NAME="filedata" SCOPE="Local"
>> >> VALUE="@@request$resultset[1,data]">
>> >> 
>> >> <@EXCLUDE>
>> >> <@ASSIGN NAME=ENCODERESULTS VALUE=FALSE SCOPE=LOCAL> <@ASSIGN 
>> >> NAME=HttpHeader SCOPE=LOCAL
>> >> VALUE="Content-type: application/pdf<@CRLF><@SETCOOKIES><@CRLF>">
>> >> </@EXCLUDE><@var request$filedata ENCODING=NONE>
>> >> 
>> >> Now I would like Adobe reader to start inside my browser and
>> >> show me the pdf,  but instead I get: Client Error The 
>> >> response received from the application server is invalid. On 
>> >> some occasions it shows the pdf binary data instead. 
>> >> 
>> >> Hope for better knowledge after San Diego trip
>> >> Cheers...
>> >> Bengt Bredin, [EMAIL PROTECTED]
>> >> Sweden
>> >> 
>> >> 
>> >> 
>> >> 
>> >> Great work Troy,
>> >> 
>> >> Something to add, that I discovered the hard way, is that
>> >> some versions of the Adobe Plug-in for PDF may not initialize 
>> >> properly because the plug-in needs to know the size of the 
>> >> document before hand.
>> >> 
>> >> So you might want to add "Content-Length:" to the HTTP
>> >> Response header, something like:
>> >> 
>> >> <@ASSIGN NAME=ENCODERESULTS VALUE=FALSE SCOPE=LOCAL> <@ASSIGN 
>> >> NAME=HttpHeader SCOPE=LOCAL VALUE="Content-type:
>> >> application/pdf<@CRLF>Content-Length: <@LENGTH STR='<@COLUMN
>> >> <@DQ>articles.art_blob<@DQ> 
>> >> ENCODING=NONE>'><@CRLF><@SETCOOKIES><@CRLF>"><@COLUMN
>> >> "articles.art_blob"
>> >> ENCODING=NONE>
>> >> 
>> >> Of course it might be more efficent to capture the <@LENGTH>
>> >> on the upload and store it a separate field next to the 
>> PDF content.
>> >> 
>> >> Hope this helps. Cheers....
>> >> 
>> >> Scott Cadillac,
>> >> Witango.org - http://witango.org
>> >> 403-281-6090 - [EMAIL PROTECTED]
>> >> --
>> >> Information for the Witango Developer Community
>> >> ---------------------
>> >> 
>> >> XML-Extranet - http://xmlx.ca
>> >> 403-281-6090 - [EMAIL PROTECTED]
>> >> --
>> >> Well-formed Development (for hire)
>> >> ---------------------
>> >> 
>> >> 
>> >> > -----Original Message-----
>> >> > From: Troy Sosamon [mailto:[EMAIL PROTECTED]
>> >> > Sent: Wednesday, September 03, 2003 10:59 AM
>> >> > To: [EMAIL PROTECTED]
>> >> > Subject: RE: Witango-Talk: PDF stored in db?
>> >> > 
>> >> > 
>> >> > Here is the trickey part that you need.
>> >> > Use a javascrip and open a new window and call a search 
>> action that 
>> >> > returns a blob and use this code:
>> >> > 
>> >> > <@EXCLUDE>
>> >> > <@ASSIGN NAME=ENCODERESULTS VALUE=FALSE SCOPE=LOCAL> <@ASSIGN 
>> >> > NAME=HttpHeader SCOPE=LOCAL
>> >> >    VALUE="Content-type: 
>> >> > application/pdf<@CRLF><@SETCOOKIES><@CRLF>">
>> >> > </@EXCLUDE><@COLUMN "articles.art_blob" ENCODING=NONE>
>> >> > 
>> >> > 
>> >> > <@comment>other content types-- VALUE="Content-type: image/jpeg, 
>> >> > text/html </@comment>
>> >> > 
>> >> > 
>> >> > Troy
>> >> > 
>> >> > 
>> >> > -----Original Message-----
>> >> > From: Troy Sosamon [mailto:[EMAIL PROTECTED]
>> >> > Sent: Wednesday, September 03, 2003 10:32 AM
>> >> > To: [EMAIL PROTECTED]
>> >> > Subject: RE: Witango-Talk: PDF stored in db?
>> >> > 
>> >> > 
>> >> > I have done it using R:tango, IIS5 and W2k.  R:tango is 
>> Tango2000 
>> >> > and an R:base database.
>> >> > 
>> >> > I am not sure about how your DB handles the blobs, but 
>> to load the 
>> >> > files, I upload the the file to a temp file on the 
>> server and then 
>> >> > do a directdbms
>> >> > command to put the file into the database.
>> >> > Pulling the pdf out if you write it to a temp file on the 
>> >> > server and link to
>> >> > that file it is very easy.
>> >> > It is a little trickier, but can be done where you pull the 
>> >> > file and send it
>> >> > directly to the browser w/o needing to put it in a file on 
>> >> the server.
>> >> > 
>> >> > Troy Sosamon
>> >> > Denver, Co.
>> >> > 
>> >> > 
>> >> > -----Original Message-----
>> >> > From: Wilcox, Jamileh (HSC) [mailto:[EMAIL PROTECTED]
>> >> > Sent: Wednesday, September 03, 2003 10:08 AM
>> >> > To: [EMAIL PROTECTED]
>> >> > Subject: Witango-Talk: PDF stored in db?
>> >> > 
>> >> > 
>> >> > Tango2000, W2K server, IIS5, SQL2K
>> >> > 
>> >> > I'm building an application to search and display lots of PDF 
>> >> > files.  My preference would be to store the files in the 
>> database,
>> >> > rather than try
>> >> > to organize and keep track of all the separate files.  Does 
>> >> > anyone know
>> >> > if this method will work with PDF files?  If so, has 
>> anyone done a
>> >> > similar app?  I'm having problems getting the files loaded & 
>> >> > displayed -
>> >> > I'm not sure if I'm doing it wrong, or if it's just not 
>> >> going to work.
>> >> > 
>> >> > Thanks for any suggestions!
>> >> > 
>> >> > jamileh
>> >> > 
>> >> > 
>> >> > ______________________________________________________________
>> >> > __________
>> >> > TO UNSUBSCRIBE: Go to http://www.witango.com/maillist.taf
>> >> > 
>> >> > ______________________________________________________________
>> >> > __________
>> >> > TO UNSUBSCRIBE: Go to http://www.witango.com/maillist.taf
>> >> > 
>> >> > ______________________________________________________________
>> >> > __________
>> >> > TO UNSUBSCRIBE: Go to http://www.witango.com/maillist.taf
>> >> > 
>> >> 
>> >> ______________________________________________________________
>> >> __________
>> >> TO UNSUBSCRIBE: Go to http://www.witango.com/maillist.taf
>> >> 
>> >> ______________________________________________________________
>> >> __________
>> >> TO UNSUBSCRIBE: Go to http://www.witango.com/maillist.taf
>> >> 
>> >_____________________________________________________________
>> __________
>> >_
>> >TO UNSUBSCRIBE: Go to http://www.witango.com/maillist.taf
>> >
>> 
>> 
>> Bill Conlon
>> 
>> To the Point
>> 345 California Avenue Suite 2
>> Palo Alto, CA 94306
>> 
>> office: 650.327.2175
>> fax:    650.329.8335
>> mobile: 650.906.9929
>> e-mail: mailto:[EMAIL PROTECTED]
>> web:    http://www.tothept.com
>> 
>> 
>> ______________________________________________________________
>> __________
>> TO UNSUBSCRIBE: Go to http://www.witango.com/maillist.taf
>> 
>________________________________________________________________________
>TO UNSUBSCRIBE: Go to http://www.witango.com/maillist.taf
>


Bill Conlon

To the Point
345 California Avenue Suite 2
Palo Alto, CA 94306

office: 650.327.2175
fax:    650.329.8335
mobile: 650.906.9929
e-mail: mailto:[EMAIL PROTECTED]
web:    http://www.tothept.com


________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/maillist.taf

Reply via email to