Vince Teachout wrote:
> Hi, all.
> 
> I'm having a very frustrating problem, and hoping someone can send the 
> clue fairy over.
> 
> In one of our apps, which has traditionally used a VFP backend, we have 
> the ability for the user to store files into memo fields in the 
> database, then later retrieve them and view them, based on file 
> extension, with whatever the default handler is for that extension on 
> their computer.
> 
> So the (simplified) gist is:
> 
> Saving the attachement:
>       cBinData     = FILETOSTR("myfile.pdf")
>       INKEY(1)  && give time to finish
>       INSERT INTO MyATTACHMENTS (Attachkey, Bindata) ;
>                         VALUES (cAttachkey, cBinData)
> 
> Retreiving is:
>       COPY MEMO bindata TO ("MyTempFile.pdf")
> 
> Viewing is simply a call to shellexec, which works fine.
> 
> We've never had problems with this in a vfp backend, but now that we're 
> using MSSQL, users are complaining of corrupted files.  One client looks 
> like they are having PDF files corrupted during save, another has some 
> issue where all but two bytes of the pdf file are copied out during the 
> retrieve, causing Adobe reader to fail.  Of course, it works fine here, 
> and I can't duplicate either problem.
> 
> We're all using MSSQL 2005, and the BinData memo field on the SQL server 
> is a TEXT field.
> 
> Would happily welcome any flames or slights on my coding ability, as 
> long as they contain clues, as well.  Thanks!

Don't you need to use a binary type on the server, like a BLOB? Otherwise the 
server 
and/or clients will think it is text and may do some encoding/decoding on it, 
get 
confused by chr(0) and the like...

Paul


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to