$ HTTP_POST_FILES我在以下代码中上载文件时遇到问题. [英] $HTTP_POST_FILES I am having the problem in following code for uploading the file.
本文介绍了$ HTTP_POST_FILES我在以下代码中上载文件时遇到问题.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下代码上传文件时出现问题.
< html>
< head>
< title>文件上传表单</title>
</head>
< body>
文件上传:
选择要上传的文件:
< form action ="/php/file_uploader.php" method ="post"
enctype ="multipart/form-data">
< input type ="file" name ="file" size ="50"/>
< input type ="submit" value =上传文件"/>
</form>
</body>
</html>
格式为file_uploader.php
if($ _FILES [''file''] [''name'']!=")
{
复制($ _FILES [''file''] [''name''],"C:\ xampp \ htdocs \ new_upload/")或
die(无法复制文件!");
}
其他
{
die(未指定文件!");
}
?>
< html>
< head>
< title>上传完成</title>
</head>
< body>
上传的文件信息:
- 已发送文件:
- 文件大小:字节
- 文件类型:
- Sent file:
- File size: bytes
- File type:
- 已发送文件:
- 文件大小:字节
- 文件类型:
- 文件类型:
- 文件大小:字节
- Sent file:
- File size: bytes
- File type:
- File type:
- File size: bytes
推荐答案
_FILES [''file''] [''name'']!=")
{
复制(_FILES[''file''][''name''] != "" )
{
copy(
_FILES [''file''] [''name''],"C:\ xampp \ htdocs \ new_upload/")或
die(无法复制文件!");
}
其他
{
die(未指定文件!");
}
?>
< html>
< head>
< title>上传完成</title>
</head>
< body>
上传的文件信息:
_FILES[''file''][''name''], "C:\xampp\htdocs\new_upload/" ) or
die( "Could not copy file!");
}
else
{
die("No file specified!");
}
?>
<html>
<head>
<title>Uploading Complete</title>
</head>
<body>
Uploaded File Info:
您遇到的错误是什么?
What is the error that you are getting?
这篇关于$ HTTP_POST_FILES我在以下代码中上载文件时遇到问题.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
- File type:
- File size: bytes
I am having the problem in following code for uploading the file.
<html>
<head>
<title>File Uploading Form</title>
</head>
<body>
File Upload:
Select a file to upload:
<form action="/php/file_uploader.php" method="post"
enctype="multipart/form-data">
<input type="file" name="file" size="50" />
<input type="submit" value="Upload File" />
</form>
</body>
</html>
on form file_uploader.php
if( $_FILES[''file''][''name''] != "" )
{
copy( $_FILES[''file''][''name''], "C:\xampp\htdocs\new_upload/" ) or
die( "Could not copy file!");
}
else
{
die("No file specified!");
}
?>
<html>
<head>
<title>Uploading Complete</title>
</head>
<body>
Uploaded File Info:
- 文件类型:
- 文件大小:字节
查看全文