Autor Zpráva
Jack06
Profil
Dobrý den píše mi to následující chybu, a nevím proč.. :-(

Notice: Undefined index: smile in C:\Software\VertrigoServ\www\prace\sp new\admin-control\smile_upload.php on line 8

Formulář:
<?php
header("Content-Type: text/html; charset=utf-8");
?>

<form method="post" enctype="multipart/form-data" action="smile_upload.php">
<fieldset><legend>Vložit smajlíka</legend>

<label for="smile">Smile: </label>
<label for="description">Popis: </label>
<label for="xxl">XXL: </label>
<label for="accessed">Schválit</label>

<input type="file" name="smile" id="smile">
<input type="text" name="description" id="description">
<input type="checkbox" name="xxl" id="xxl">
<input type="checkbox" name="accessed" id="accessed" checked="checked">

<input type="submit" name="add_smile" value = "Nahrát">
</fieldset>
</form>


php:
<?php require_once "../_core.php";

// ujisteni existence promenych
$destination = '../smiles';

if(!isset($_POST['xxl'])){$_POST['xxl'] = 'n';}
if(!isset($_POST['accessed'])){$_POST['accessed'] = 'n';}

//hlavni cast uploadu
if(is_uploaded_file($_FILES['smile']['tmp_name'])){ // zde to píše tu chybu.. :-(
$pathinfo = pathinfo($_FILES['smile']['name']);
$permited_file_types = array('gif','GIF');
if(in_array($pathinfo['extension'],$permited_file_types)){
$s  = $db->query("select id from smile_list ORDER BY id DESC limit 1"); 
$sm = $s->fetch_assoc();  
if($sm['id'] < 1){$next_id = "1";}else{ $next_id = $data_p['id']+1; } 
$name = "$next_id.$pathinfo[extension]";

if(move_uploaded_file($_FILES['smile']['tmp_name'],"$destination/$name")){
 $smi = imagecreatefromgif("$destination/$name");
if(imagesx($smi) <= 40 && imagesy($smi) <= 50){
    $c = $db->query("INSERT INTO `smile_list` 
          				(id, description, typ, accessed)
          				   VALUES 
          				('$next_id','$_POST[description]','$_POST[xxl]','$_POST[accessed]')");
if($c != 1) { unlink("$destination/$name"); header("location: ?class=8&err=sm5"); exit; }
}else{  imagedestroy ($im); 
        unlink("$destination/$name"); 
        header("location: ?class=8&err=sm4");
        exit;
     }
unlink("$destination/$name");
}else{header("location: ?class=8&err=sm3"); exit;}

}else{header("location: ?class=8&err=sm2"); exit;}

}else{exit;header("location: ?class=8&err=sm1"); exit;}     
header("location: ?class=8&err=sm0"); exit;
?>

Taps
Profil
Jack06
je to spíše upozornění že v souboru index.php nebyla definováná proměnná smile
stejný problém se řešil na http://diskuse.jakpsatweb.cz/index.php?action=vthread&topic=80656&forum=9&page=-1
Jack06
Profil
Taps
Takže mi to neb ude dělat neplechu?? když tam dám ten error_reporting (E_ALL ^ E_NOTICE); ?
fandaa
Profil
Jack06
Dej třeba tohle:
if(isset($_FILES['smile']) && is_uploaded_file($_FILES['smile']['tmp_name'])){

Vaše odpověď

Mohlo by se hodit


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm:

0