文件上传

 <?php
if($_FILES["file"]!=null){
$oldumask=umask(0); 
mkdir('img',0777); 
umask($oldumask);
if(move_uploaded_file($_FILES["file"]["tmp_name"],"./img/".$_FILES["file"]["name"])){
echo "文件上传成功";
}else{

echo "文件上传失败";

}
}else{
?>


<html>
<body>

<form action="" method="post" enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" /> 
<br />
<input type="submit" name="submit" value="Submit" />
</form>

</body>
</html>
<?php }?>

评论

刷新

友情链接