reset and begin
7/06/2009

file upload

<form action="anh.php" method="post" enctype="multipart/form-data" name="form1" id="form1"> upload <?php for($i=0;$i<3;$i++)


{ ?> <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); ?>


Bloger Comments
G+ Comments
Comments FaceBook

No comments:

List

Profiles Information


About me : Nothing is 1 vài thứ - 1985

Places I've Lived : I Hà Nội

Home Page : http://www.shimivn.blogspot.com/

Think : 1:1000000000

Languages spoken : Vietnamese,English.

Mobile : sony C2305

dell : i3-Ram 3GB- HDD 250GB .