Всем привет.Ребята у меня такая проблема , Как сделать так чтобы было Обязательное поле при заливке фото ?* http://skrinchik[dot]pp[dot]ru Вот смотрите.ВЫ допустим хотите загрузить фото и не выбрали фото но нажали на кнопку Загрузить А вам всплывает табличка и в ней написано типа (Извините но вы не выбрали фото для загрузки на сервер).Буду благодарен вам за помощь )
Вот мой upload.php
PHP:
скопировать код в буфер обмена
<? include("log.php"); //create thumbnails function createthumb($name,$sourcetype,$filename,$new_w,$new_h){ if ($sourcetype==".jpg"){ } if ($sourcetype==".png"){ } if ($sourcetype==".gif"){ } if ($old_x > $old_y) { $thumb_w=$new_w; $thumb_h=$old_y*($new_h/$old_x); } if ($old_x < $old_y) { $thumb_w=$old_x*($new_w/$old_y); $thumb_h=$new_h; } if ($old_x == $old_y) { $thumb_w=$new_w; $thumb_h=$new_h; } } //------------------------ START HERE ------------------ include("blok/config.php"); include("blok/top.php"); if ($_FILES['userfile']['size']>$max_size) { echo "<p align=center>".$lang['toobig']."</p>"; } $pictype=""; case "image/jpeg" : $pictype=".jpg"; break; case "image/pjpeg": $pictype=".jpg"; break; case "image/gif" : $pictype=".gif"; break; case "image/png" : $pictype=".png"; break; case "image/x-png": $pictype=".png"; break; default : $pictype=""; break; } if($pictype!="") { //------- do { $srcfile=$path.$uniq.$pictype; $res = copy($_FILES['userfile']['tmp_name'], $srcfile); if (!$res) { echo "<p align=center>".$lang['copyerr']."</p>"; } //set url variable $imgf = $path . $uniq . $pictype; $thbf = $tpath . $uniq . ".jpg"; createthumb($imgf,$pictype,$thbf,$tsize,$tsize); $urlf = $domain . $path . $uniq . $pictype; // ?> <center><p><b><?=$lang['success']?></b></p></center> <center><a href='v.php?id=<?=$uniq.$pictype?>' target=_blank><img src='<?=$tpath.$uniq.".jpg"?>' border=0></a><br><br></center> <center><?=$lang['directurl']?>:<br></center> <center><input type="text" size="70" onmouseover="this.select()" value="<?=$urlf;?>"><br><br></center> <center><?=$lang['tekst']?>:<br></center> <center><input type="text" size="70" onmouseover="this.select()" value="[url=http://skrinchik.pp.ru][IMG]<?=$domain.$tpath.$uniq.".jpg"?>[/IMG][/url]"><br><br></center> <center><?=$lang['bbcode']?>:<br></center> <center><input type="text" size="70" onmouseover="this.select()" value="[url=<?=$domain?>v.php?id=<?=$uniq.$pictype?>][img]<?=$domain.$tpath.$uniq.".jpg"?>[/img][/url]"><br><br></center> <center><?=$lang['html']?>:<br></center> <center><input type="text" size="70" onmouseover="this.select()" value="<a href='<?=$domain?>v.php?id=<?=$uniq.$pictype?>' target=_blank><img src='<?=$domain.$tpath.$uniq.".jpg"?>' border=0></a>"><br><br></center> <center><?=$lang['url']?>:<br></center> <center><input type="text" size="70" onmouseover="this.select()" value='<?=$domain?>v.php?id=<?=$uniq.$pictype?>'><br><br></center> <? //------ } else { echo "<p align=center>".$lang['format']."</p>"; include("blok/bottom.php"); include("blok/blok-niz.php"); ?>
(Отредактировано автором: 07 Апреля, 2010 - 23:45:40)
|