Allow binary uploads

This commit is contained in:
Michal Čihař
2003-02-03 20:35:16 +00:00
parent 86358f1efc
commit ea04a49e0a
2 changed files with 15 additions and 4 deletions

View File

@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
$Id$ $Id$
$Source$ $Source$
2003-02-03 Michal Cihar <nijel@users.sourceforge.net>
* 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 <me@supergarv.de> 2003-02-03 Garvin Hicking <me@supergarv.de>
* pdf_schema.php3, libraries/dbg/profiling.php3, * pdf_schema.php3, libraries/dbg/profiling.php3,
libraries/xpath/XPath.class.php: Backwards compatibility (foreach loops) libraries/xpath/XPath.class.php: Backwards compatibility (foreach loops)

View File

@@ -10,10 +10,17 @@
if (isset(${"fields_upload_" . $key}) && !empty(${"fields_upload_" . $key})) { if (isset(${"fields_upload_" . $key}) && !empty(${"fields_upload_" . $key})) {
$data_file = ${"fields_upload_" . $key}; $data_file = ${"fields_upload_" . $key};
$val = fread(fopen($data_file, "rb"), filesize($data_file)); $val = fread(fopen($data_file, "rb"), filesize($data_file));
// must always add slashes for an uploaded file: if (isset(${"fields_upload_binary_" . $key})) {
// - do not use PMA_sqlAddslashes() // nijel: This is probably the best way how to put binary data
// - do not check get_magic_quotes_gpc() // into MySQL and it also allow not to care about charset
$val = "'" . addslashes($val) . "'"; // 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 { } else {
// f i e l d v a l u e i n t h e f o r m // f i e l d v a l u e i n t h e f o r m