Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2007
    Posts
    212

    Unanswered: 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?

  2. #2
    Join Date
    Sep 2009
    Location
    San Sebastian, Spain
    Posts
    880
    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
    Certified Oracle DBA/Certified MySQL Expert (DBA & Cluster DBA)
    http://www.it-iss.com
    Follow me on Twitter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •