Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Ken Murphy
  Where is Ken Murphy?
 Springhill
 Canada
 Ken Murphy
 To: David Jo
  Where is David Jo?
 Buffalo Grove
 Illinois - United States
 David Jo
 Tags
Subject: RE: PDF stored as binary
Thread ID: 112459 Message ID: 112468 # Views: 2 # Ratings: 0
Version: Visual FoxPro 9 Category: Databases, Tables and SQL Server
Date: Wednesday, November 08, 2006 9:31:51 PM         
   


> > > Has anybody stored PDF or JPG files in binary format on a SQL Server? I've got a need where I'd much rather have a PDF or JPG converted to binary format and then saved in a SQL record. I'm not sure if this is possible, or even advisable. I'm thinking maybe a hundred pages worth of docs or images in a particular day. Disk space is not an issue, but performance would be.
> > >
> > > Any insights would be appreciated.
> > >
> > > Thanks,
> > > David

> >
> > David,
> >
> > I deal with a LOT of image files (30,000+ per year) and I wouldn't even dream of storing them in a table. Where I need to, I store the path and filename in my table and then access the image/pdf/what ever directly.
> >
> > If you must, you can store these images in a BLOB or BinaryMemo field. Look at FILETOSTR() and STRTOFILE() in help.
> >
> > Ken
> > You shall know the truth - and the truth shall set you free. (John 8:33)

>
>
>
> Ken, thanks for the prompt response. These images and docs are in nature confidential and I'd like to make sure unauthorized viewing is not possible, which is why I thought record vs. file. Are your images accessable outside of the application?
>
> David


They are visible outside of the app, but only to authorized users. I am not sure this will help you though. My images are stored by region, project and subprojects. For example, in the "Haiti" region directory, there is a "Jeremie" Project folder and inside that folder there is a "LBL" sub-project folder. Haiti region users can see anything in or under the Haiti folder. Jeremie users can see anything in or under the Jeremie folder. LBL users can only see the LBL folder. I can therefore use Active Directory user groups to when assigning permissions. I am not sure if this fits your requirements. It may indeed be easier to simply store the images in a BLOB field. With SQL Server, you don't have file size limitations like you do with VFP tables. If I were to store my images in a VFP table, I would only get about half of them stored and I would run into VFP's 2gig limit. (I mention this for anybody working in a VFP backend and wanting to store images in the table.)

As I said, take a look at the FILETOSTR() function.
lcImageFile = FILETOSTR([Path2\MyImage.JPG])
lnSomeForeignKey = 1234
SQLEXEC(lnHndl,;
   [INSERT INTO MyTable (nForeignKey, blImageFile) VALUES (?lnSomeForeignKey, ?lcImageFile)])


Ken
You shall know the truth - and the truth shall set you free. (John 8:33)

ENTIRE THREAD

PDF stored as binary Posted by David Jo @ 11/8/2006 8:48:38 PM
RE: PDF stored as binary Posted by Ken Murphy @ 11/8/2006 9:04:55 PM
RE: PDF stored as binary Posted by David Jo @ 11/8/2006 9:08:47 PM
RE: PDF stored as binary Posted by Ken Murphy @ 11/8/2006 9:31:51 PM
RE: PDF stored as binary Posted by David Jo @ 11/8/2006 9:39:48 PM
RE: PDF stored as binary Posted by Ken Murphy @ 11/8/2006 9:44:46 PM
RE: PDF stored as binary Posted by Borislav Borissov @ 11/8/2006 9:50:37 PM
RE: PDF stored as binary Posted by Ken Murphy @ 11/9/2006 12:20:11 AM
RE: PDF stored as binary Posted by David Jo @ 11/8/2006 9:56:03 PM
RE: PDF stored as binary Posted by Ken Murphy @ 11/9/2006 12:18:19 AM
RE: PDF stored as binary Posted by Borislav Borissov @ 11/8/2006 9:34:43 PM
RE: PDF stored as binary Posted by Ilya Rabyy @ 11/9/2006 12:09:54 AM
RE: PDF stored as binary Posted by Ken Murphy @ 11/9/2006 12:28:00 AM
RE: PDF stored as binary Posted by Ilya Rabyy @ 11/9/2006 12:35:40 AM
RE: PDF stored as binary Posted by Borislav Borissov @ 11/8/2006 9:37:32 PM
RE: PDF stored as binary Posted by David Jo @ 11/8/2006 9:42:49 PM
RE: PDF stored as binary Posted by Borislav Borissov @ 11/8/2006 9:47:42 PM