[help] php的http上传文件问题 你只帖了表单,没有帖真正上传的源程序.PS:PHP的http上传容易出错的地方:1.服务器上传的文件夹的属性应为"777"(Linux);2.文件大小不能超过"MAX_FILE_SIZE"; 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这是php内容[我加上注释了] /* PHP 源程序。 自定函数: get_param(); 获得HTTP_POST_VARS 和 HTTP_GET_VARS & REQUEST_STR.. format_tags();==htmlspecialchar() error(); */ <? if(get_param('action')=="add_products"){ $s_item=format_tags(get_param("item")); $s_pnum=format_tags(get_param("p_num")); $s_pdes=format_tags(get_param("p_des")); $s_pfun=format_tags(get_param("p_fun")); if($s_pnum=="") error("ERROR:\\nProduct Number NULL!"); if($s_pdes=="") error("ERROR:\\nProduct Description NULL!"); if(!is_uploaded_file($_FILES['img']['tmp_name'][0])) error("ERROR:\\nUpload Product Small Photo Failed!"); if(!is_uploaded_file($_FILES['img']['tmp_name'][1])) error("ERROR:\\nUpload Product Large Photo Failed!"); $ext_name=substr($_FILES['img']['tmp_name'][0],-4,4); $save_imgs=time().random('6','1').strtolower($ext_name); if($ext_name!=".jpg" || $ext_name!=".gif" || $ext_name!=".JPG" || $ext_name!=".GIF" ) error("ERROR:\\nUpload File Type UNLL!\\nOnly support JPG/GIF"); Move_uploaded_file($_FILES['img']['tmp_name'][0], $pdt_dir.$save_imgs); $ext_name=substr($_FILES[img][tmp_name][1],-4,4); $save_imgb=time().random('6','1').strtolower($ext_name); if($ext_name!=".jpg" || $ext_name!=".gif" || $ext_name!=".JPG" || $ext_name!=".GIF" ) error("ERROR:\\nUpload File Type UNLL! Only support JPG/GIF"); Move_uploaded_file($_FILES[img][tmp_name][1], $pdt_dir.$save_imgb); $date="20".date('y-m-d h:i:s'); $db->query("Insert into products values ('','".get_session('s_user')."','$s_item','$s_pnum','$save_imgs','$save_imgb','$s_pdes','$s_pfun','$date')"); error("Add Product Successful,Please Continue..."); } ?> 真是的,一个问题等了3天! 还程序员大本营呢! Shit!Shit!Shit!Shit!Shit!Shit!Shit!Shit!Shit!Shit!Shit!Shit!Shit!Shit!Shit!Shit!Shit!Shit!Shit!Shit!Shit!Shit!Shit!Shit!Shit!Shit!Shit! php中a href 和直接输入地址的区别 时间转换问题 数据库连接问题!求救! 百分请教关于PHP文件下载的的文件大小限制,达人进 php页面上怎样调用别人页面的内容 php文字水印用imagettftext做,如何计算文字所占宽高?? select sum(test2.c3) from test2 where test2.c4=test.c2这句SQL有错吗? 如何实现图片的缩略图? 怎么总是说有错? 请求帮助!!!!急!!! [help] php的http上传文件问题 两个设置分页的都出问题,想屎了...
/*
PHP 源程序。
自定函数:
get_param(); 获得HTTP_POST_VARS 和 HTTP_GET_VARS & REQUEST_STR..
format_tags();==htmlspecialchar()
error();
*/
<?
if(get_param('action')=="add_products"){ $s_item=format_tags(get_param("item"));
$s_pnum=format_tags(get_param("p_num"));
$s_pdes=format_tags(get_param("p_des"));
$s_pfun=format_tags(get_param("p_fun")); if($s_pnum=="") error("ERROR:\\nProduct Number NULL!");
if($s_pdes=="") error("ERROR:\\nProduct Description NULL!"); if(!is_uploaded_file($_FILES['img']['tmp_name'][0])) error("ERROR:\\nUpload Product Small Photo Failed!"); if(!is_uploaded_file($_FILES['img']['tmp_name'][1])) error("ERROR:\\nUpload Product Large Photo Failed!"); $ext_name=substr($_FILES['img']['tmp_name'][0],-4,4);
$save_imgs=time().random('6','1').strtolower($ext_name);
if($ext_name!=".jpg" || $ext_name!=".gif" || $ext_name!=".JPG" || $ext_name!=".GIF" ) error("ERROR:\\nUpload File Type UNLL!\\nOnly support JPG/GIF");
Move_uploaded_file($_FILES['img']['tmp_name'][0], $pdt_dir.$save_imgs); $ext_name=substr($_FILES[img][tmp_name][1],-4,4);
$save_imgb=time().random('6','1').strtolower($ext_name);
if($ext_name!=".jpg" || $ext_name!=".gif" || $ext_name!=".JPG" || $ext_name!=".GIF" ) error("ERROR:\\nUpload File Type UNLL! Only support JPG/GIF");
Move_uploaded_file($_FILES[img][tmp_name][1], $pdt_dir.$save_imgb); $date="20".date('y-m-d h:i:s');
$db->query("Insert into products values ('','".get_session('s_user')."','$s_item','$s_pnum','$save_imgs','$save_imgb','$s_pdes','$s_pfun','$date')");
error("Add Product Successful,Please Continue...");
}
?>