From 663a8a7bf9af9d238182de73118829f959e84420 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Fri, 4 May 2007 10:22:35 +0000 Subject: [PATCH] =?UTF-8?q?Upload=20von=20Bildern=20bei=20Vorschl=C3=A4gen?= =?UTF-8?q?=20funktioniert=20nun=20wieder?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cis/testtool/admin/index.php | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/cis/testtool/admin/index.php b/cis/testtool/admin/index.php index 2a00890c4..17586d207 100644 --- a/cis/testtool/admin/index.php +++ b/cis/testtool/admin/index.php @@ -28,8 +28,8 @@ require_once('../../../include/functions.inc.php'); require_once('../../../include/frage.class.php'); require_once('../../../include/vorschlag.class.php'); require_once('../../../include/benutzerberechtigung.class.php'); - -$PHP_SELF=$_SERVER["PHP_SELF"]; + +$PHP_SELF=$_SERVER["PHP_SELF"]; //wandelt einen String in HEX-Werte um function strhex($string) @@ -165,11 +165,15 @@ if(isset($_POST['submitdata'])) if(isset($_POST['submitvorschlag'])) { $content=''; - if(isset($_FILES['bild']['tmp_name']) && is_uploaded_file($_FILES['bild']['tmp_name'])) + if(isset($_FILES['bild']['tmp_name'])) { - //Wenn File ein Bild ist - if (($_FILES['bild']['type']=="image/gif") || ($_FILES['bild']['type']=="image/jpeg") || ($_FILES['bild']['type']=="image/png")) - { + //Extension herausfiltern + $ext = explode('.',$_FILES['bild']['name']); + $ext = strtolower($ext[count($ext)-1]); + + //--check that it's a jpeg or gif or png + if ($ext=='gif' || $ext=='png' || $ext=='jpg' || $ext=='jpeg') + { $filename = $_FILES['bild']['tmp_name']; //File oeffnen $fp = fopen($filename,'r'); @@ -182,6 +186,10 @@ if(isset($_POST['submitvorschlag'])) else echo "Datei ist kein Bild!
"; } + else + { + echo "kein Bild"; + } $vorschlag = new vorschlag($conn); $error=false; @@ -340,7 +348,7 @@ if($frage->frage_id!='') } //Vorschlag echo 'Vorschlag'.($vorschlag_id!=''?' Edit':'').'

'; - echo "
"; + echo ""; echo ""; echo ''; echo '';