{ ?> <input type="file" name="up<?php echo $i ?>" id="up" /> <?php } ?> <input type="submit" value="upload" /> </form>
anh.php
<?php $target="up6/"; $conn=mysql_connect("localhost","root",""); $mystr=mysql_select_db("data",$conn) or die("loi");
if(is_dir($target)==false) { mkdir($target); } for($i=0;$i<3;$i++) { $link=$target.$_FILES['up'.$i]['name']; if(move_uploaded_file($_FILES['up'.$i]['tmp_name'],$link)==true) { $thongbao="up thanh cong"; }
$qs="insert into images (link) values ('$link')"; mysql_query($qs) or die ('loi'); $thongbao2="insert thanh cong"; }
echo($thongbao); echo($thongbao2); ?>
No comments: