]> git.joonet.de Git - adminer.git/commitdiff
Show upload_max_filesize
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Thu, 16 Jul 2009 13:46:49 +0000 (13:46 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Thu, 16 Jul 2009 13:46:49 +0000 (13:46 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@841 7c3ca157-0c34-0410-bff1-cbf682f78f5c

adminer/include/functions.inc.php
adminer/lang/cs.inc.php
adminer/select.inc.php
adminer/sql.inc.php

index 998e0c2860ecf444c7017af20ed9c1b849aa8184..9d909019ccd0298b3218830a550f0aa20876aa47 100644 (file)
@@ -151,6 +151,11 @@ function get_file($key) {
        return (!$_FILES[$key] || $_FILES[$key]["error"] ? $_FILES[$key]["error"] : file_get_contents($_FILES[$key]["tmp_name"]));
 }
 
+function upload_error($error) {
+       $max_size = ($error == UPLOAD_ERR_INI_SIZE ? ini_get("upload_max_filesize") : null); // post_max_size is checked in index.php
+       return lang('Unable to upload a file.') . ($max_size ? " " . lang('Maximum allowed file size is %sB.', $max_size) : "");
+}
+
 function odd($s = ' class="odd"') {
        static $i = 0;
        if (!$s) { // reset counter
index 475cf8b5f8912210f51e8bc720758077b384083a..ecb999c6fb8b13e4755b1c0de0339948b99f09f8 100644 (file)
@@ -228,4 +228,5 @@ $translations = array(
        'Binary' => 'Binární',
        'Lists' => 'Seznamy',
        'Relations' => 'Vztahy',
+       'Maximum allowed file size is %sB.' => 'Maximální povolená velikost souboru je %sB.',
 );
index 337d1ba991adbc51e7ba63153f914162ad81c0cb..93a1196a085f04aeb343c310d90b5e975c310a94 100644 (file)
@@ -166,7 +166,7 @@ if ($_POST && !$error) {
                $result = queries("INSERT INTO " . idf_escape($_GET["select"]) . "$cols VALUES" . implode(",", $rows));
                query_redirect(queries(), remove_from_uri("page"), lang('%d row(s) has been imported.', $dbh->affected_rows), $result, false, !$result);
        } else {
-               $error = lang('Unable to upload a file.');
+               $error = upload_error($file);
        }
 }
 
index e1c2a6e8aa7d522ea59eceb28030d9274017fec2..8f9d24881f43ff1fd7d29845485bab498821ae3a 100644 (file)
@@ -3,7 +3,8 @@ page_header(lang('SQL command'), $error);
 $history = &$_SESSION["history"][$_GET["server"]][$_GET["db"]];
 
 if (!$error && $_POST) {
-       if (is_string($query = (isset($_POST["file"]) ? get_file("sql_file") : $_POST["query"]))) { // get_file() returns error as number
+       $query = (isset($_POST["file"]) ? get_file("sql_file") : $_POST["query"]);
+       if (is_string($query)) { // get_file() returns error as number
                @set_time_limit(0); // set_time_limit() can be disabled
                $query = str_replace("\r", "", $query); // parser looks for \n
                $query = rtrim($query);
@@ -64,7 +65,7 @@ if (!$error && $_POST) {
                        echo "<p class='message'>" . lang('No commands to execute.') . "\n";
                }
        } else {
-               echo "<p class='error'>" . lang('Unable to upload a file.') . "\n";
+               echo "<p class='error'>" . upload_error($query) . "\n";
        }
 }
 ?>