/*
* Created on 2012-6-7
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
if( is_uploaded_file($_FILES['upfile']['tmp_name'])){
$upfile=$_FILES["upfile"];
$name=$upfile["name"];
$type=$upfile["type"];
$size=$upfile["size"];
$tmp_name=$upfile["tmp_name"];
$error=$upfile['error'];
switch($type){
case'image/pjpeg':$ok=1;
break;
case'image/jpeg':$ok=1;
break;
case'image/gif':$ok=1;
break;
case'image/png':$ok=1;
break;
}
if($ok&&$error=='0'){
move_uploaded_file($tmp_name,'E:image/'.$name);
echo"上傳成功";}else {echo"上傳失敗";};
}
><form action="" method="post" enctype="multipart/form-data" name="upfile">
上傳文件:
<input type="file" name="upfile" >
<input type="submit" value="上傳"/><br/>
</form>
試試這個吧,把這個當成上傳頁面,插入到妳的網頁中應該就行了