PHP檔案上傳範例
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
發布: 2016-07-25 08:45:24
处理代码:
- 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代码:
|
文件上傳, PHP
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
作者最新文章
-
2024-10-22 09:46:29
-
2024-10-13 13:53:41
-
2024-10-12 12:15:51
-
2024-10-11 22:47:31
-
2024-10-11 19:36:51
-
2024-10-11 15:50:41
-
2024-10-11 15:07:41
-
2024-10-11 14:21:21
-
2024-10-11 12:59:11
-
2024-10-11 12:17:31