图片上传错误 [英] Image Upload Errorrrr

查看:71
本文介绍了图片上传错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我有一个页面,从输入中我上传图像并将其保存到数据库.

我尝试过该代码:

hi all

i have a page which from an input i upload an image and save it to the database.

i tried that code :

$dir="./item/";
$PicUser = $_POST['userfile'];
if (!empty($PicUser))
{
$imgarr=getimagesize($PicUser);
echo $imgarr;
$imgarr=array("100","100","2");
if ($imgarr[0] <= 300 AND $imgarr[1] <= 300)
{
$id=@mysql_result(@mysql_query("select id from shop_item order by id desc"),0,0);
if (!is_uploaded_file ($PicUser))
{
$error_teks=" couldn't be copied !!";
}
if (is_uploaded_file ($PicUser))
{
$desfile="shop_$id.jpg";
move_uploaded_file($PicUser,$dir.$desfile) ;
}   
copy($PicUser, "item/shop_$id.jpg");
$image="item/shop_$id.jpg";
mysql_query("update shop_item set picture='$image' where id='$id'");
}
else
{
$error_teks="Can not upload file . Maximum size is 300x300";
}
}



路径已正确存储,但是图像本身未上传到服务器.


有任何帮助,请???


谢谢



the path is stored correctly , but the image itself doesn''t be uploaded to the server.


Any Help ,please???


Thanks

推荐答案

dir = " ;
dir="./item/";


PicUser =
PicUser =


_POST [ ' 用户文件']; 如果(!empty(
_POST['userfile']; if (!empty(


这篇关于图片上传错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆