关于网页内上传图片的问题求助!
Re关于网页内上传图片的问题求助!
上面乱码了~ 前台表单代码;
enctype='multipart/form-data'>
图像文件:
-------------------------
Re关于网页内上传图片的问题求助!
用的是php来做处理:
if ((($_FILES['file']['type'] == 'image/gif')
|| ($_FILES['file']['type'] == 'image/jpeg')
|| ($_FILES['file']['type'] == 'image/png')
|| ($_FILES['file']['type'] == 'image/pjpeg'))
&& ($_FILES['file']['size'] {
if ($_FILES['file']['error'] > 0)
{
echo 'Return Code: ' . $_FILES['file']['error'] . '';
}
else
{
echo 'Upload: ' . $_FILES['file']['name'] . '';
echo 'Type: ' . $_FILES['file']['type'] . '';
echo 'Size: ' . ($_FILES['file']['size'] / 1024) . ' Kb';
echo 'Temp file: ' . $_FILES['file']['tmp_name'] . '';
$uploaddir='/upload/';
$filename=$_FILES['file']['name'];
$uploadfile=$uploaddir . $filename;
if (file_exists($filename))
{
echo $_FILES['file']['name'] . ' already exists. ';
}
else
{
move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile);
copy($_FILES['file']['tmp_name'],'$uploadfile');
echo '';
if (is_uploaded_file($_FILES['file']['tmp_name'])==true)
{ //输出预览图片
if (file_exists($uploadfile)==true)
{echo 'Yes!';}
else {echo 'No!';}
echo '您的文件已经上传完毕 上传预览图片:
';
echo $_FILES['file']['error'];
}
else{
'上传失败!';
}
echo 'Stored in: ' . 'upload/' . $_FILES['file']['name'];
}
}
}
else
{
echo '无效文件';
}
?>
-------------------------
Re关于网页内上传图片的问题求助!
但测试的结果是上传了服务器里没有显示
赞0
踩0