[Solar-talk] Blob 'server'

Paul M Jones pmjones at solarphp.com
Thu Jan 24 11:29:00 CST 2008


On Jan 24, 2008, at 10:24 , Kilbride, James P. wrote:
> Anybody done anything where they need to provide a binary image to  
> users with some form of authentication/authorization format? Basic  
> standard CMS type thing where you need to store documents or images  
> or some other binary data and only certain users should have access  
> to it. So you need the controller to do a standard authorization  
> check and then pull the data from somewhere to serve back up? Have  
> you done this with solar (is there a standard component for this?  
> It'd be great if there was.) My plan was to store them in the  
> database as clobs(which i know isn't a solar type but was planning  
> to the model to have one column like that) and then make sure the  
> view or controller sets the type to other than text.
>
Done things like that before, but a long time ago, before Solar.  No,  
there's no Solar-standard component for it; however, my suggestions  
based on that earlier experience follow.

In the DB, store the path to the file, not the file itself (and maybe  
the mime type, file name, etc).  Keep the file itself outside the web  
root.  Then the controller can check authentication/authorization, and  
if successful, it can respond by reading the file from the filesystem  
and passing via stream to the browser (vs linking to the file  
directly).  Keeping the binary file in the DB under a CLOB type (which  
*is* a Solar generic type, generally represented as a "longtext" in  
MySQL) is, in my opinion, to be avoided when possible.

Hope that helps.


-- pmj


More information about the Solar-talk mailing list