If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Converting binary data back to original form

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-09-11, 15:30
ozzii ozzii is offline
Registered User
 
Join Date: Mar 2007
Posts: 194
Converting binary data back to original form

Hi,

I have a table which has word or pdf documents stored as Blobs. The table also has a field which identifies the content type i.e. (application/ms-word, application/octet-stream, text/plain) and another field which identifies the orginal filename.

table as follows:

Code:
 CREATE TABLE `tbl_myfiles` (
	`FileID` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
        `FileName` VARCHAR(50) NULL DEFAULT NULL,
	`FileSize` MEDIUMINT(8) UNSIGNED NULL DEFAULT NULL,
	`ContentType` VARCHAR(50) NULL DEFAULT NULL,
	`BinaryData` MEDIUMBLOB NULL,
        PRIMARY KEY (`FileID`)
)
Is there a way in Mysql to convert this data back to its original form and save it to a folder?
Reply With Quote
  #2 (permalink)  
Old 01-10-11, 04:19
it-iss.com it-iss.com is offline
Registered User
 
Join Date: Sep 2009
Location: San Sebastian, Spain
Posts: 623
There is nothing in MySQL directly but this can be done programatically in PHP. I have put together some code sample to show how this can be done in PHP. Check out the following link MySQL – Inserting and reading BLOB’s in PHP « IT Integrated Business Solutions
__________________
Ronan Cashell
Senior Oracle/MySQL DBA
http://www.it-iss.com
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On