处理代码:
- header('Content-Type:text/html;charset=UTF-8');
- //准备接收
- /*
- echo '文件名:'.$_FILES['userfile']['name'];
- echo '文件大小:'.$_FILES['userfile']['size'];
- echo '错误:'.$_FILES['userfile']['error']; */
-
- //print_r($_FILES)
- $tmpFile=$_FILES['userfile']['tmp_name'];
- if(is_uploaded_file($tmpFile))
- {
- echo '正在上传。。。';
-
-
- if(!file_exists('uploads'))//如果文件夹不存在
- {
- mkdir('uploads');
- }
- $moveFile =move_uploaded_file($tmpFile, 'uploads/'.$_FILES['userfile']['name']);
-
- if($moveFile)
- {
- echo "移动成功!";
-
- //echo '';
-
- }else
- {
- echo '移动失败!';
- }
-
- }else
- {
- echo "临时文件夹找不到文件";
-
- }
- ?>
复制代码
HMTL代码:
|