Seems like a base64 encode and then save to a blob column would do it. But I 
don't have any experience at it. You will probably need another column for the 
original file name so you could restore it "as is". 

So the pseudocode would look like:
get the file name via answer file dialog
bail out if user cancels
open file read/write (in case someone else has it open and is updating it)
if successful read into variable
base64 encode data
write to mySQL blob column
write filename to char(50) column

This will work for files that are easily contained in memory. If you have to 
deal with large files, that becomes problematic I would think. You would have 
to read the data in limited blocks, save each block to a separate SQL record, 
then use an SQL statement to combine all the records into one final record 
before deleting the temp copies. At least that is how I would attempt to do it. 

Bob


On Mar 15, 2010, at 2:24 PM, Andrew Kluthe wrote:

> 
> I have a need to store image files and document files (reports) to my mySQL
> database. I know it is arguably unconventional to do this, but the need and
> requirement is there. Does anyone have any experience doing this within rev?
> I have seen alot of tutorials documenting this in PHP. 
> 
> Worst case: I use a php script to handle this process. But, I would like to
> do this straight from my rev program.
> -- 
> View this message in context: 
> http://n4.nabble.com/Saving-files-to-database-tp1594051p1594051.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
> _______________________________________________
> use-revolution mailing list
> use-revolution@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to