Home  >  Article  >  Backend Development  >  ~图片下传时发生的异常

~图片下传时发生的异常

WBOY
WBOYOriginal
2016-06-13 13:06:42860browse

求助~图片上传时发生的错误~
php部分

 
if(!empty($_POST["tjsp11"])){
$file_path="../uploadpic/";
$pic_type=array(".jpg",".png",".gif");
$up_name=$_FILES["tjsp11"]["name"];
//echo $up_name;
$pic_name=substr($up_name,strrpos($up_name,"."));
$up_date=date("ymdhis");
if(!in_array($pic_name,$pic_type)){
echo "Error Pic Type";
exit();
}
if($_FILES[u_file][size]>=0){//未限制大小
echo "图片不能超过1MB";
exit();
}
else{
move_uploaded_file($_FILES["tjsp11"]["tmp_name"],$file_path.$up_date.$pic_type);
}
}
?>

html部分


商品照片:


我尝试着echo $up_name; 没有任何输出的内容。不知道问题出在哪儿了,图片依然上传不了。麻烦详细点帮我挑挑错。

------解决方案--------------------

图片上传这里要加
------解决方案--------------------
建议先看看这里吧:http://www.w3school.com.cn/php/php_file_upload.asp
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn