文件上傳的問題 我的一個form表單上傳文件,可以用echo 上傳的路徑,$_FILES['userfile']['name'] 得到任何的值。菜虫,请大家指点。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你想问什么?form中加一个type是file的input就可以了.input的名字叫userfile 我是在 form中加一个type是file的input,但是我在action的页面中用$_FILES['userfile']['name']什么都得不到。但是可以echo $_POST[uploadfile]显示出路劲;uploadfile是form中的file input的名字 就是在action的 页面中 echo $_FILES['userfile']['name'];什么都出不来。 <form action="" enctype="multipart/form-data" method="post" >form表单的enctype写了么? 加了,<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title></head><body><? /*if(!is_numeric($_POST[etprice])) { echo("<script> alert('市場價一定要是數字!' ); history.back();</script>"); } if(!is_numeric($_POST[memberprice])) { echo("<script> alert('會員價只能是數字!');history.back();</script>"); } $gname = $_POST[gname];*/ $year = $_POST[year]; $month = $_POST[month]; $date = $_POST[date]; $etprice = $_POST[etprice]; $memberprice = $_POST[memberprice]; $gtype = $_POST[typename]; $cate = $_POST[cate]; $brand = $_POST[brand]; $goodstype = $_POST[goodstype]; $recomend = $_POST[recomend]; $resum = $_POST[resum]; $uploadfile = $_POST[uploadfile]; echo($uploadfile); echo($_FILES['userfile']['name'] ); ?></body></html> echo($uploadfile);有值,但是 echo($_FILES['userfile']['name'] );没有值。奇怪。 echo($_FILES['userfile']['tmp_name']); 加个print_r($_FILES);看看结果,如果是空的就像4L说的看看你的enctype="multipart/form-data" 写了没 网站的功能 做一个类似ikea的网站 mysql 保留字问题 关于md5函数 页面操作一段时间后没有响应,提示重新登陆的php代码 PHP中怎么得到机器的上盘符? 老问题,没解决,哪位高手帮帮忙? 在PHP中,如何传递参数,关于下拉列表框的问题!在线等待 因为我要辞职创业,公司需要一个程序员顶替我的位置。要求熟悉ASP和PHP。公司对我不错,所以帮忙找找看 需要对一 text 输入框 进行ip地址检验 mysql 索引问题 jquery+ajax+PHP表单验正
form中加一个type是file的input就可以了.input的名字叫userfile
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<?
/*if(!is_numeric($_POST[etprice]))
{
echo("<script> alert('市場價一定要是數字!' ); history.back();</script>");
}
if(!is_numeric($_POST[memberprice]))
{
echo("<script> alert('會員價只能是數字!');history.back();</script>");
}
$gname = $_POST[gname];*/
$year = $_POST[year];
$month = $_POST[month];
$date = $_POST[date];
$etprice = $_POST[etprice];
$memberprice = $_POST[memberprice];
$gtype = $_POST[typename];
$cate = $_POST[cate];
$brand = $_POST[brand];
$goodstype = $_POST[goodstype];
$recomend = $_POST[recomend];
$resum = $_POST[resum];
$uploadfile = $_POST[uploadfile];
echo($uploadfile);
echo($_FILES['userfile']['name'] ); ?>
</body>
</html>
有值,但是 echo($_FILES['userfile']['name'] );
没有值。奇怪。