From ea04a49e0ac2b236d87768c810fe0ab568aa922a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Mon, 3 Feb 2003 20:35:16 +0000 Subject: [PATCH] Allow binary uploads --- ChangeLog | 4 ++++ tbl_replace_fields.php3 | 15 +++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 63c5b4d36..bbd0424e5 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,10 @@ phpMyAdmin - Changelog $Id$ $Source$ +2003-02-03 Michal Cihar + * libraries/display_tbl.lib.php3, tbl_change.php3: Show blob size (RFE #678729). + * tbl_replace_fields.php3, tbl_change.php3: Allow binary uploads. + 2003-02-03 Garvin Hicking * pdf_schema.php3, libraries/dbg/profiling.php3, libraries/xpath/XPath.class.php: Backwards compatibility (foreach loops) diff --git a/tbl_replace_fields.php3 b/tbl_replace_fields.php3 index d56ead83b..3f7075caf 100755 --- a/tbl_replace_fields.php3 +++ b/tbl_replace_fields.php3 @@ -10,10 +10,17 @@ if (isset(${"fields_upload_" . $key}) && !empty(${"fields_upload_" . $key})) { $data_file = ${"fields_upload_" . $key}; $val = fread(fopen($data_file, "rb"), filesize($data_file)); - // must always add slashes for an uploaded file: - // - do not use PMA_sqlAddslashes() - // - do not check get_magic_quotes_gpc() - $val = "'" . addslashes($val) . "'"; + if (isset(${"fields_upload_binary_" . $key})) { + // nijel: This is probably the best way how to put binary data + // into MySQL and it also allow not to care about charset + // conversion that would otherwise corrupt the data. + $val = '0x' . bin2hex($val); + } else { + // must always add slashes for an uploaded file: + // - do not use PMA_sqlAddslashes() + // - do not check get_magic_quotes_gpc() + $val = "'" . addslashes($val) . "'"; + } } else { // f i e l d v a l u e i n t h e f o r m