Revin cu inca o intrebare.
Cum pot face sa verific daca a fost selectata imaginea si daca nu a fost atunci sasi ia un alt caracter ?
Aici am codul :
Codul sursa :
Cod: Selectaţi tot
<label>Icon : </label>
<div class="input-rows">
<input name="avatar" type="file" id="file" />
<input type="hidden" name="avataractual" id="file" value="<?=$game['icon']?>"/>
</div>
Cod: Selectaţi tot
if(!isset($_FILES['avatar'])){
getEdit($_POST['nume'], $_POST['desc'], $_POST['avataractual'], $_POST['idmark'], $_POST['stare'], $_POST['cat'], $_POST['key'], $_GET['e']);
header("Location: index.php");
exit;
}
else{
// locul unde se va salva imaginea
$uploadpath = "../images/c/";
// marimea maxima a imaginii
$max_size = 2048;
// lungimea maxima a imaginii
$max_width = 300;
// inaltimea maxima a imaginii
$max_height = 300;
// tipurile de imaginii permise
$allowtype = array('bmp', 'png', 'gif', 'jpg', 'jpeg', 'JPEG', 'JPG', 'PNG', 'GIF', 'BMP', 'webp');
list($width, $height, $type, $attr) = getimagesize($_FILES['avatar']['tmp_name']);
if($width <= $max_width){
if($height <= $max_height){
$type = end(explode(".", strtolower($_FILES['avatar']['name'])));
$redenumire = redenumire_fisier();
$uploadpath = $uploadpath . $redenumire.".".$type;
if(in_array($type, $allowtype)) {
if($_FILES['avatar']['size']<=$max_size*1000) {
move_uploaded_file($_FILES['avatar']['tmp_name'], $uploadpath);
$fisier_name = explode("/",$uploadpath);
getEdit($_POST['nume'], $_POST['desc'], $fisier_name['3'], $_POST['idmark'], $_POST['stare'], $_POST['cat'], $_POST['key'], $_GET['e']);
header("Location: index.php");
exit;
}
}
}
}
}
Cod: Selectaţi tot
Warning: getimagesize() [function.getimagesize]: Filename cannot be empty in /home/g9y9/public_html/admin/template/edit.php on line 39