不知道为什么,以下是代码
<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 = $_POST['img'];
if ( !copy( $file_source,$path."/".$netId.".jpg" ) )
echo "fail";
else
echo "successful"; //copy($filePath,$dest."/".basename($filePath)) ?>
<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 = $_POST['img'];
if ( !copy( $file_source,$path."/".$netId.".jpg" ) )
echo "fail";
else
echo "successful"; //copy($filePath,$dest."/".basename($filePath)) ?>
解决方案 »
- 高手帮忙呀,CURL抓取https一直redirects followed,这个页面是怎么加事?
- 有谁知道这段JS什么意思
- 数组相加为什么取出了只有第一个值呢?麻烦各位给看一下。
- MYSQL提取数据,语法如何写?
- 学习php!
- php新新手提问,分割出一条判断语句
- PHP能接收另一个SERVER上ASP传过来的值吗?
- die 提示的消息都去哪了?
- 紧急求助:错误 MySQL 返回:Too many connections,给分100,在线等待,多谢大家!
- 请问如果光写了一句 $ArrTest[1000]=999,那么实际上内存中是只开了这一个空间,还是开了1001个?
- 如何copy文件到指定文件夹
- 求php高手用正则表达式筛选url的二级域
<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)) ?>
跟$file_source有什么区别吗
$file_source['tmp_name'] $file_source 是上传文件的详细信息, 'tmp_name' 是存储在缓存中的上传文件,可以用$file_source['tmp_name']获取;