21,887
社区成员
发帖
与我相关
我的任务
分享
<html>
<head>
<title>上传图片</title>
</head>
<body>
<form action="build.php" method="post" enctype="multipart/form-data" name="form1">
<p>
<label>
<input type="file" name="img" id="img">
</label>
</p>
<p>
<label>
<input type="submit" name="button" id="button" value="ok">
</label>
</p>
</form>
</body>
</html>
<?php
$path = "studentimages";
$mode = 0777;
$netId = "G199026";
mkdir($path,$mode);
$file_source = $_FILES['img'];
if ( !copy( $file_source['tmp_name'],$path."/".$netId.".jpg" ) )
echo "fail";
else
echo "successful";
//copy($filePath,$dest."/".basename($filePath))
?>