保存在表中的路径
C:apacheapache2htdocsmobileupfilesNokia7200.jpg
显示图片:echo "<img src=".$img_name.">";
红叉
属性file:///C:apacheapache2htdocsmobileupfilesNokia7200.jpg
请问错在哪儿?
11 个解决方案
#1
可能是使用strip_slashes函数去掉了"\";
#2
我没用strip_slashes啊用的是
copy($sfile, $dfile)
然后插入$dfile数据库
copy($sfile, $dfile)
然后插入$dfile数据库
#3
$dfile="C:\\apache\\apache2\\htdocs\\mobile\\upfiles\\".$_FILES['image']['name']; //上传文件夹
\要转义
\要转义
#4
被楼上的抢先了一步
#5
加上\也不行
还是老样子
还是老样子
#6
你的基本思路就错了
#7
$sfile=$_FILES['image']['name'];
$dfile="C:\\apache\\apache2\\htdocs\\mobile\\upfiles\\".$_FILES['image']['name'];
copy($sfile, $dfile);
而且很怪的,只有放在C:\\apache\\apache2\\htdocs\\mobile\目录下的图片才能上传,其他目录则有
Warning: copy(111.jpg): failed to open stream: No such file or directory in C:\apache\Apache2\htdocs\mobile\added.php on line 23
$dfile="C:\\apache\\apache2\\htdocs\\mobile\\upfiles\\".$_FILES['image']['name'];
copy($sfile, $dfile);
而且很怪的,只有放在C:\\apache\\apache2\\htdocs\\mobile\目录下的图片才能上传,其他目录则有
Warning: copy(111.jpg): failed to open stream: No such file or directory in C:\apache\Apache2\htdocs\mobile\added.php on line 23
#8
回复人: phplover(主动、交流、挑战、责任) ( ) 信誉:107 2004-07-25 21:44:00 得分: 0
你的基本思路就错了
--------------------
为什么呢
你的基本思路就错了
--------------------
为什么呢
#9
分数太少啊,嘿嘿...
function shop_upload(){
global $upfile,$filename,$edit,$upfile_type,$img_name;
if (isset($upfile)){
if (($upfile_type=="image/gif") || ($upfile_type=="image/pjpeg") || ($upfile_type=="image/x-png")):
// 构造文件名
$datetime = date("Ymd");//YmdHis_
$img_name = "images/".$datetime.$upfile_name;
$filename = "images/".$datetime.$upfile_name;
// 将文件存放到服务器
if (copy($upfile,$filename)):
else:echo "upload error! \n";
endif;
else:echo "Your Select None Image File!\n";
endif;}
if (empty($edit)){
echo "<form enctype=multipart/form-data action=adm_shop_index.php?add=add method=POST><td align=right>".UPLOAD_IMAGE.":</td><td><input type=file name=upfile size=30 value=\"$img_name\"><input type=submit value=\"upload\"></td></form>";
}else{
echo "<form enctype=multipart/form-data action=adm_shop_index.php?edit=$edit method=POST><td align=right>".UPLOAD_IMAGE.":</td><td><input type=file name=upfile size=30 value=\"$img_name\"><input type=submit value=\"upload\"></td></form>";}
}
<?
if (isset($upfile)){
if (($upfile_type=="image/gif") || ($upfile_type=="image/pjpeg") || ($upfile_type=="image/x-png")):
$img_name = "images/".$upfile_name;
$filename = "images/".$upfile_name;
// 将文件存放到服务器
if (copy($upfile,$filename)):
else:
echo "upload error! \n";
endif;
else:
echo "Your Select None Image File!\n";
endif;
}
if (empty($edit)){
echo "<form enctype=multipart/form-data action=adm_shop_index.php?add=add method=POST><td align=right>".UPLOAD_IMAGE.":</td><td><input type=file name=upfile size=30 value=\"$img_name\"><input type=submit value=\"upload\"></td></form>";
}else{
echo "<form enctype=multipart/form-data action=adm_shop_index.php?edit=$edit method=POST><td align=right>".UPLOAD_IMAGE.":</td><td><input type=file name=upfile size=30 value=\"$img_name\"><input type=submit value=\"upload\"></td></form>";}
?>
function shop_upload(){
global $upfile,$filename,$edit,$upfile_type,$img_name;
if (isset($upfile)){
if (($upfile_type=="image/gif") || ($upfile_type=="image/pjpeg") || ($upfile_type=="image/x-png")):
// 构造文件名
$datetime = date("Ymd");//YmdHis_
$img_name = "images/".$datetime.$upfile_name;
$filename = "images/".$datetime.$upfile_name;
// 将文件存放到服务器
if (copy($upfile,$filename)):
else:echo "upload error! \n";
endif;
else:echo "Your Select None Image File!\n";
endif;}
if (empty($edit)){
echo "<form enctype=multipart/form-data action=adm_shop_index.php?add=add method=POST><td align=right>".UPLOAD_IMAGE.":</td><td><input type=file name=upfile size=30 value=\"$img_name\"><input type=submit value=\"upload\"></td></form>";
}else{
echo "<form enctype=multipart/form-data action=adm_shop_index.php?edit=$edit method=POST><td align=right>".UPLOAD_IMAGE.":</td><td><input type=file name=upfile size=30 value=\"$img_name\"><input type=submit value=\"upload\"></td></form>";}
}
<?
if (isset($upfile)){
if (($upfile_type=="image/gif") || ($upfile_type=="image/pjpeg") || ($upfile_type=="image/x-png")):
$img_name = "images/".$upfile_name;
$filename = "images/".$upfile_name;
// 将文件存放到服务器
if (copy($upfile,$filename)):
else:
echo "upload error! \n";
endif;
else:
echo "Your Select None Image File!\n";
endif;
}
if (empty($edit)){
echo "<form enctype=multipart/form-data action=adm_shop_index.php?add=add method=POST><td align=right>".UPLOAD_IMAGE.":</td><td><input type=file name=upfile size=30 value=\"$img_name\"><input type=submit value=\"upload\"></td></form>";
}else{
echo "<form enctype=multipart/form-data action=adm_shop_index.php?edit=$edit method=POST><td align=right>".UPLOAD_IMAGE.":</td><td><input type=file name=upfile size=30 value=\"$img_name\"><input type=submit value=\"upload\"></td></form>";}
?>
#10
\\要转义的哦才成“\"
#11
我把反斜杠改成斜杠
一切OK
谢谢大家!
一切OK
谢谢大家!
#1
可能是使用strip_slashes函数去掉了"\";
#2
我没用strip_slashes啊用的是
copy($sfile, $dfile)
然后插入$dfile数据库
copy($sfile, $dfile)
然后插入$dfile数据库
#3
$dfile="C:\\apache\\apache2\\htdocs\\mobile\\upfiles\\".$_FILES['image']['name']; //上传文件夹
\要转义
\要转义
#4
被楼上的抢先了一步
#5
加上\也不行
还是老样子
还是老样子
#6
你的基本思路就错了
#7
$sfile=$_FILES['image']['name'];
$dfile="C:\\apache\\apache2\\htdocs\\mobile\\upfiles\\".$_FILES['image']['name'];
copy($sfile, $dfile);
而且很怪的,只有放在C:\\apache\\apache2\\htdocs\\mobile\目录下的图片才能上传,其他目录则有
Warning: copy(111.jpg): failed to open stream: No such file or directory in C:\apache\Apache2\htdocs\mobile\added.php on line 23
$dfile="C:\\apache\\apache2\\htdocs\\mobile\\upfiles\\".$_FILES['image']['name'];
copy($sfile, $dfile);
而且很怪的,只有放在C:\\apache\\apache2\\htdocs\\mobile\目录下的图片才能上传,其他目录则有
Warning: copy(111.jpg): failed to open stream: No such file or directory in C:\apache\Apache2\htdocs\mobile\added.php on line 23
#8
回复人: phplover(主动、交流、挑战、责任) ( ) 信誉:107 2004-07-25 21:44:00 得分: 0
你的基本思路就错了
--------------------
为什么呢
你的基本思路就错了
--------------------
为什么呢
#9
分数太少啊,嘿嘿...
function shop_upload(){
global $upfile,$filename,$edit,$upfile_type,$img_name;
if (isset($upfile)){
if (($upfile_type=="image/gif") || ($upfile_type=="image/pjpeg") || ($upfile_type=="image/x-png")):
// 构造文件名
$datetime = date("Ymd");//YmdHis_
$img_name = "images/".$datetime.$upfile_name;
$filename = "images/".$datetime.$upfile_name;
// 将文件存放到服务器
if (copy($upfile,$filename)):
else:echo "upload error! \n";
endif;
else:echo "Your Select None Image File!\n";
endif;}
if (empty($edit)){
echo "<form enctype=multipart/form-data action=adm_shop_index.php?add=add method=POST><td align=right>".UPLOAD_IMAGE.":</td><td><input type=file name=upfile size=30 value=\"$img_name\"><input type=submit value=\"upload\"></td></form>";
}else{
echo "<form enctype=multipart/form-data action=adm_shop_index.php?edit=$edit method=POST><td align=right>".UPLOAD_IMAGE.":</td><td><input type=file name=upfile size=30 value=\"$img_name\"><input type=submit value=\"upload\"></td></form>";}
}
<?
if (isset($upfile)){
if (($upfile_type=="image/gif") || ($upfile_type=="image/pjpeg") || ($upfile_type=="image/x-png")):
$img_name = "images/".$upfile_name;
$filename = "images/".$upfile_name;
// 将文件存放到服务器
if (copy($upfile,$filename)):
else:
echo "upload error! \n";
endif;
else:
echo "Your Select None Image File!\n";
endif;
}
if (empty($edit)){
echo "<form enctype=multipart/form-data action=adm_shop_index.php?add=add method=POST><td align=right>".UPLOAD_IMAGE.":</td><td><input type=file name=upfile size=30 value=\"$img_name\"><input type=submit value=\"upload\"></td></form>";
}else{
echo "<form enctype=multipart/form-data action=adm_shop_index.php?edit=$edit method=POST><td align=right>".UPLOAD_IMAGE.":</td><td><input type=file name=upfile size=30 value=\"$img_name\"><input type=submit value=\"upload\"></td></form>";}
?>
function shop_upload(){
global $upfile,$filename,$edit,$upfile_type,$img_name;
if (isset($upfile)){
if (($upfile_type=="image/gif") || ($upfile_type=="image/pjpeg") || ($upfile_type=="image/x-png")):
// 构造文件名
$datetime = date("Ymd");//YmdHis_
$img_name = "images/".$datetime.$upfile_name;
$filename = "images/".$datetime.$upfile_name;
// 将文件存放到服务器
if (copy($upfile,$filename)):
else:echo "upload error! \n";
endif;
else:echo "Your Select None Image File!\n";
endif;}
if (empty($edit)){
echo "<form enctype=multipart/form-data action=adm_shop_index.php?add=add method=POST><td align=right>".UPLOAD_IMAGE.":</td><td><input type=file name=upfile size=30 value=\"$img_name\"><input type=submit value=\"upload\"></td></form>";
}else{
echo "<form enctype=multipart/form-data action=adm_shop_index.php?edit=$edit method=POST><td align=right>".UPLOAD_IMAGE.":</td><td><input type=file name=upfile size=30 value=\"$img_name\"><input type=submit value=\"upload\"></td></form>";}
}
<?
if (isset($upfile)){
if (($upfile_type=="image/gif") || ($upfile_type=="image/pjpeg") || ($upfile_type=="image/x-png")):
$img_name = "images/".$upfile_name;
$filename = "images/".$upfile_name;
// 将文件存放到服务器
if (copy($upfile,$filename)):
else:
echo "upload error! \n";
endif;
else:
echo "Your Select None Image File!\n";
endif;
}
if (empty($edit)){
echo "<form enctype=multipart/form-data action=adm_shop_index.php?add=add method=POST><td align=right>".UPLOAD_IMAGE.":</td><td><input type=file name=upfile size=30 value=\"$img_name\"><input type=submit value=\"upload\"></td></form>";
}else{
echo "<form enctype=multipart/form-data action=adm_shop_index.php?edit=$edit method=POST><td align=right>".UPLOAD_IMAGE.":</td><td><input type=file name=upfile size=30 value=\"$img_name\"><input type=submit value=\"upload\"></td></form>";}
?>
#10
\\要转义的哦才成“\"
#11
我把反斜杠改成斜杠
一切OK
谢谢大家!
一切OK
谢谢大家!