]> git.joonet.de Git - adminer.git/commitdiff
Warn about exceeded max_file_uploads in import
authorJakub Vrana <jakub@vrana.cz>
Wed, 4 Jun 2025 12:04:24 +0000 (14:04 +0200)
committerJakub Vrana <jakub@vrana.cz>
Wed, 4 Jun 2025 12:04:24 +0000 (14:04 +0200)
CHANGELOG.md
adminer/lang/cs.inc.php
adminer/lang/xx.inc.php
adminer/sql.inc.php
adminer/static/editing.js

index 83cf4869940b29b7ee24db4028a9c7fb2855d845..bc4543a908579ced8b964604a67265c7d9b49913 100644 (file)
@@ -1,5 +1,6 @@
 ## Adminer dev
 - Allow specifying operator in search anywhere
+- Warn about exceeded max_file_uploads in import
 - MySQL 5.0-: Do not load partitioning info in alter table (bug #1099)
 - PostgreSQL: Show structure of inherited tables
 - PostgreSQL: Hide only partitions, not all inherited tables from menu
index 5551ab9327006ee8c0e25f914904dcd415927767..6c12c37da7ebe57e954ed8a5a396db23c4586cd7 100644 (file)
@@ -76,6 +76,7 @@ Lang::$translations = array(
        'Webserver file %s' => 'Soubor %s na webovém serveru',
        'Run file' => 'Spustit soubor',
        'File does not exist.' => 'Soubor neexistuje.',
+       'Increase %s.' => 'Zvyšte %s.',
        'File uploads are disabled.' => 'Nahrávání souborů není povoleno.',
        'Unable to upload a file.' => 'Nepodařilo se nahrát soubor.',
        'Maximum allowed file size is %sB.' => 'Maximální povolená velikost souboru je %sB.',
index e3e9572207f9119fe381f8f1c631053171205a27..a0e2099dff165c1bd6358b26b73ccba1669b6bf6 100644 (file)
@@ -77,6 +77,7 @@ Lang::$translations = array(
        'Webserver file %s' => 'Xx %s',
        'Run file' => 'Xx',
        'File does not exist.' => 'Xx.',
+       'Increase %s.' => 'Xx %s.',
        'File uploads are disabled.' => 'Xx.',
        'Unable to upload a file.' => 'Xx.',
        'Maximum allowed file size is %sB.' => 'Xx %sB.',
index ce349663ea1d0b8b0c04512c0ac1984fe1e24864..c2908c5396a21187201c8fe453a21d82a08b8860 100644 (file)
@@ -250,8 +250,11 @@ if (!isset($_GET["import"])) {
 } else {
        echo "<fieldset><legend>" . lang('File upload') . "</legend><div>";
        $gz = (extension_loaded("zlib") ? "[.gz]" : "");
+       $max_file_uploads = "max_file_uploads";
+       $max_file_uploads_value = ini_get($max_file_uploads);
        echo (ini_bool("file_uploads")
-               ? "SQL$gz (&lt; " . ini_get("upload_max_filesize") . "B): <input type='file' name='sql_file[]' multiple>\n$execute" // ignore post_max_size because it is for all form fields together and bytes computing would be necessary
+               ? "SQL$gz (&lt; " . ini_get("upload_max_filesize") . "B): <input type='file' name='sql_file[]' multiple>\n" // ignore post_max_size because it is for all form fields together and bytes computing would be necessary
+                       . script("qsl('input').onchange = partialArg(fileChange, $max_file_uploads_value, '" . lang('Increase %s.', "$max_file_uploads = $max_file_uploads_value") . "')") . $execute
                : lang('File uploads are disabled.')
        );
        echo "</div></fieldset>\n";
index 67a8a549220d0eb63011cec858b5b9ca078eedc8..ac76a8d650ae4607fe5934809669ba2b28bcc8b0 100644 (file)
@@ -665,6 +665,17 @@ function sqlSubmit(form, root) {
        }
 }
 
+/** Check if PHP can handle the uploaded files
+* @param number
+* @param string
+* @param Event
+*/
+function fileChange(event, maxFileUploads, message) {
+       if (event.target.files.length > maxFileUploads) {
+               alert(message);
+       }
+}
+
 
 
 /** Handle changing trigger time or event