[thelist] Extracting (compressed?) files from a MySQL database

Domingo Galán Alberto alberto.domingo at uah.es
Fri May 6 17:28:46 CDT 2016


Hi Roel,

Code and fragments of text is more or less what you see opening a .doc file with a plain text editor. May just be corrupted, not encoded or compressed.

In te case of .docx, try to change the extension to .zip and open it. Not as a solution, but to try to identify the problem.

Alberto

Enviado desde mi iPad

> El 06/05/2016, a las 11:47, "Roel Mulder" <roel.mulder at gmail.com> escribió:
> 
> Hi all,
> The following challenge is facing me. A client requested me to help get his
> files out of a MySQL database. The developer of their system is gone,
> history being what it is.
> 
> I'm facing 26268 records with a total 1.8GB filesize in MySQL.
> What i did in PHP: query the file_content (MEDIUMBLOB), file_name,
> file_date, LIMIT 10.
> 
> while ($row = mysql_fetch_array($result)) {
>  $file = fopen('/var/www/vhosts/path/'.$row['file_name'], 'w+');
>  fwrite($file, $row['file_content']);
>  fclose($file);
>  touch('/var/www/vhosts/path/'.$row['file_name'],
> strtotime($row['file_date']));
> }
> 
> This gives me the files (.doc .docx .pdf .msg), however I can't open them
> with their default programs. Opening them in a text editor does show code
> and fragments of text.
> Could the files be compressed prior to storing in MySQL?
>  fwrite($file, gzdeflate($row['file_content']));
> 
> Now I can open them with their default program, to see many paged documents
> with unreadable text fragments.
> 
> Does anyone have suggestions on how to extract them files to usable
> conditions?
> Cheers, Roel
> -- 
> 
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
> 
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt ! 


More information about the thelist mailing list